Difficulty: Easy
Correct Answer: ostream
Explanation:
Introduction:
C++ iostreams define several stream classes for input and output. Recognizing which class std::cout belongs to is a foundational library fact that affects which operators and manipulators you can use.
Given Data / Assumptions:
Concept / Approach:
The output stream type in the iostream hierarchy is std::ostream. std::cout is a global object of type std::ostream (technically std::ostream& bound to a buffered streambuf). The companion input stream is std::cin (std::istream). std::iostream is a bidirectional stream type, and std::ifstream is file input, neither of which is the type of std::cout.
Step-by-Step Solution:
1) Identify std::cout as the standard output stream.2) Match “output stream” to class std::ostream in the library taxonomy.3) Rule out input-only and file-only types (std::istream, std::ifstream).4) Conclude the correct choice is std::ostream.
Verification / Alternative check:
Inspect the declaration in the standard library headers or documentation; you will find extern std::ostream cout; in namespace std (the exact signature can vary slightly by vendor).
Why Other Options Are Wrong:
iostream: a bidirectional stream type; std::cout is not of this type.istream: used for input like std::cin.ifstream: file input stream for reading from files, not console output.
Common Pitfalls:
Confusing std::iostream (type) with
Final Answer:
ostream
Discussion & Comments