So I wrote this very simple program:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string input;
cin >> input;
cout<< input<<endl;
cin >> input;
cout<< input<<endl;
cin >> input;
cout<< input<<endl;
return 0;
}
I type in 'word1 word2 word3' on one line and the output as expected is
word1
word2
word3
now of course, I could've gotten the same output as for (int i=0; i <3; i++){cin>>input; cout << input<<endl;}
.
Which brings me to my question. As soon as cin runs out of things to read from stdin, it will query the user (stdin).
I a way to detect whether cin will read something from the stdin buffer or query the user.
I know its a simple question, but its for homework... and I'm in a massive work-induced time cruch, so kudos to whoever shares the power!