'What is the difference between c in and c out in C++? [closed]

I don't understand how these two differ. Feels unnecessarily complicated and kind of redundant. My teacher keeps saying it's two different functions but when i do c in it wont print anything -- I'm not sure if this is a software issue or whether my teacher is giving me poor information.

For example: cin << var1 and then it won't graph my data...can't seem to fix this and my teacher says I'm a lost cause, I don't understand. How can I graph these features without some input information? I don't think my professor fully understands. Any help would be appreciated.



Solution 1:[1]

C++ programs operate under the assumption that the program has one input source (accessible via cin) and two output streams, one for regular output (accessible via cout) and one for reporting errors (accessible via cerr).

(There's also clog, which is like cout but which doesn't buffer its output. I've almost never seen it used in practice).

Because cin is just for input, you can use it to read values but not for writing values. Similarly, you can write to cout and cerr, but you can't read from them.

I'm guessing (?) that C++ didn't combine all of these into a single source (a hypothetical "call") because of the asymmetry of having two different output streams and one input stream. Though in principle it would have been possible to do this.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 templatetypedef