string line; while (getline(cin,line)){ stringstream ss(line); int num; while (ss >> num){ // } }