Okay, how do I make for example
show <<
to be equal to
cout <<
Thank you in advance!
Printable View
Okay, how do I make for example
show <<
to be equal to
cout <<
Thank you in advance!
Code:#include <iostream>
using namespace std;
int main()
{
ostream show = cout;
show << "Hello world!" << endl;
return 0;
}
lmov's code won't work with compilers that use the standard C++ implementation (but will work with MSVC). If this doesn't work you could try this -
Code:#include <iostream>
using namespace std;
int main()
{
ostream &show = cout;
show << "hello world\n";
return 0;
}