Reputation: 18097
I want to do this:
cout<< cin;
Instead of this:
int x;
cin>>x;
cout<<x;
I have tried this:
cout<< (cin>>); //no luck
I hope it's clear that what i want.
Upvotes: 5
Views: 2306
Reputation: 726629
Once you turn off skipping of whitespace, you should be able to do it in one string, but it's going to be a pretty long string:
std::copy(
std::istream_iterator<char>(std::cin)
, std::istream_iterator<char>()
, std::ostream_iterator<char>(std::cout,"")
);
Upvotes: 3