difference of cout and myfile

i have this code..

#include <iostream>
#include <fstream>
#include <string>

main()
{

ostream myfile;
string myinput;
}

the question is..
what is the difference of
cout<<myinput; in myfile<<myinput; ?

if i want to save it on file at the same time print it in console,, should i put both?
The difference is that cout does not write to your file (although it could be redirected..). cout is also an ostream object. What differs is the target.

If you want to have your input in two places, you'll have to write it two times.
so if i want it to appear in my console and write it in my file.. i should put both?
yes
Topic archived. No new replies allowed.