Original Post
🔒 Locked
Difference between these two
Advertisement
[edit: whoops, not quite]Well, in this case they end up being exactly the same thing. In general, though, you should prefer the stream insertion operator (operator<<), as it performs formatted input (assuming this is what you want).
jfl.
jfl.
From MSDN:
cout.put() is said to put a character in the stream, and the overloaded << operator writes to the stream. Basically, cout.put() can only write a single character the the console, while cout<< will write an entire string; if you pass a string to cout.put(), you will get a compiler error.
EDIT: Beaten to it...
cout.put() is said to put a character in the stream, and the overloaded << operator writes to the stream. Basically, cout.put() can only write a single character the the console, while cout<< will write an entire string; if you pass a string to cout.put(), you will get a compiler error.
EDIT: Beaten to it...
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement