C++ Tutorial 5: Input and Specialized output
C++ has an interesting way of doing output:
cout also has a brother called cerr. Cerr works the same way but it is used for errors instead of just normal output, it will also log the message to the console on most systems so:
If you look in the logs you will find that Program: Error: Some Error Happened or something like that depending on your system.
To get input in C++ you use cin. Now here is an example project combining both cout, cerr, and cin.
Cin works like this:
cin >> variable;
notice << versus >>;
<< is sending the text to cout while >> is sending the input to the user :).
Finally There is one more thing:
clog is the same as cerr except that it is used for logs no errors. So:
would create a message in the logs on most sytems which is “Logged”.