I have a problem - I want to store values from standard input line to an int but am unsure how to convert to an int:
string line;
int value;
getline(cin,line);
istringstream ss(line);
while (ss>>line) {
if (ss.eof()==false) {
// stores non ints in strings
}
else {
value=line; //ERROR
}
}
I have tried to convert this using standard documentation material but I am going nowhere. What am I doing wrong?