Suppose I want to read line a of integers from input like this:
1 2 3 4 5\n
I want cin to stop at '\n' character but cin doesn't seem to recognize it.
Below is what I used.
vector<int> getclause() {
char c;
vector<int> cl;
while ( cin >> c && c!='\n') {
cl.push_back(c);
cin>>c;
}
return cl;
}
How should I modify this so that cin stop when it see the '\n' character?