Difficulty: Easy
Correct Answer: True
Explanation:
Introduction / Context:C++ uses a rich stream abstraction for input and output. Different stream classes handle reading and writing, sometimes in combination. Grasping which streams are for input and which are for output is essential when selecting the appropriate headers, objects, and operators in your program.
Given Data / Assumptions:
Concept / Approach:
Step-by-Step Explanation:
Identify class roles: istream → input, ostream → output, iostream → both.Map to common objects: std::cin is an istream; std::cout/std::cerr are ostreams.File streams mirror this: ifstream (in), ofstream (out), fstream (in/out).Verification / Alternative check:
Compile a small snippet using ifstream to read and ofstream to write; the types enforce directionality through available operations and open modes.Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
True
Discussion & Comments