I'm not fluent in C++, so I'm sorry that this is such a simple question. I'm working on a school assignment and in one of the questions, it asks us to write a function with the following prototype
void function_name(istream &in, ostream &out, other arguments);
I don't really know what the first two arguments mean. From what I know, and correct me if I'm wrong. An istream is a class that is used in input. cin is an object of this class. An ostream is a class that is used in output. cout and cerr are objects of this class. objects of the istream class have methods such as fail() and .eof() to detect errors during input. Objects of the ostream class have methods such as .width() and .precision() to help format the output.
So from what I understand in the question, the first two arguments must be pointers to istream and ostream objects. Can anyone give me an example of a function that takes istream and ostream object pointers as arguments so that I can understand how to use them in my question?
Sorry if this is too long. Thanks for the help.
*), they are references (&). - Colin Basnettnull, while a reference is "guaranteed" (sort of) to be a valid object. The calling convention is also different for pointers. There are plenty of resources like this one (programmers.stackexchange.com/questions/195337/…) that can explain it in detail. Highly recommended to understand the differences. - Colin Basnett