   Difference between these two
  What is the difference between the two code and which should I use?#include <iostream>using namespace std;int main() {char c;while ( cin.get(c) ) cout<<c;} And #include <iostream>using namespace std;int main() {char c;while ( cin.get(c) ) cout.put(c);} 
  [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.   ;  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...   