+ 2

What do "<<" stand for?

what is the purpose of them? are they used to put a command to the code?

30th Jan 2018, 9:43 PM
Hasib Hossain
Hasib Hossain - avatar
4 odpowiedzi
+ 3
In most programming languages, the << operator means bitwise rotate left.
30th Jan 2018, 9:48 PM
SplittyDev
SplittyDev - avatar
+ 2
In that case, the << operator is overloaded to mean redirection. You basically redirect the text to the standard output stream (cout).
30th Jan 2018, 10:08 PM
SplittyDev
SplittyDev - avatar
+ 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?
30th Jan 2018, 9:54 PM
Hasib Hossain
Hasib Hossain - avatar
+ 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.
30th Jan 2018, 10:10 PM
non