Discuss the meaning of each of the following objects:
a) std::cin
b) std::cout
Solution:
The std:: before cout is required when we use names that we’ve brought into the program by the preprocessor directive #include . The notation std::cout specifies that we are using a name, in this case cout, that belongs to “namespace” std. The names cin (the standard input stream) and cerr (the standard error stream) also belong to namespace std.
a) std::cin
b) std::cout
Solution:
The std:: before cout is required when we use names that we’ve brought into the program by the preprocessor directive #include . The notation std::cout specifies that we are using a name, in this case cout, that belongs to “namespace” std. The names cin (the standard input stream) and cerr (the standard error stream) also belong to namespace std.
Post A Comment:
0 comments: