New course! Every coder should learn Generative AI!
Try a free lesson+ 5
cerr is like cout but for standard error.
If you have an error message or something error-related, that can be a good message to send to standard error(cerr) instead of standard output.
If you run your c++ program in the simplest way, you'll see output from standard error and standard output exactly the same way. If, however, you redirect standard error to a specified file, you will only see standard output messages in the terminal.
Standard input, standard output, standard error are not specific to c++. Those streams are very useful for chaining commands together and shell scripting. It is very common in Linux and Unix to do this.