Which standard header must be included to use std::cout and std::cin in C++?
Correct answer
D. <iostream>
16 views
D. <iostream>
16 views
<iostream> declares the standard stream objects cout, cin, cerr and clog together with the insertion and extraction operators. <fstream> adds file streams, <iomanip> adds manipulators such as setw, and <string> adds std::string, though none of these supplies cout. Including only <string> is a common beginner error that produces an undeclared-identifier message for cout.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is D? Ask here and get an explanation.