+ 2
What do "<<" stand for?
what is the purpose of them? are they used to put a command to the code?
4 Antworten
+ 3
In most programming languages, the << operator means bitwise rotate left.
+ 2
In that case, the << operator is overloaded to mean redirection. You basically redirect the text to the standard output stream (cout).
+ 1
I'm learning the basics of C++, so for example:
{
cout<<"Hello world"<<endl<<"I feel great"
do the "<<" get used as a input command? or maybe a separation mark?
+ 1
In this case it's (the << operator) redirecting "Hello World" to a C++ object: cout. The cout object, on most OSes, is just stdout.
It can be used for input with the C++ object: cin. Now cin works with this operator: >>. Example:
int tel;
std::cin >> tel;
Of coure validating input it up to you ;) The difference is we're usually reading stdout into tel now.
Yep, stdout is basically a file. But don't worry too much about it, just look at the examples. Hope it helps.