Something like...
?Code:while(userInput != "goodbye") { bool found = false; while (getline(check, temp)) { stringstream format; format << temp; format >> index >> temp; if (userInput == temp) { while (getline(answr, comparestring)) { stringstream convert; convert << comparestring; convert >> comparenum; getline(convert, comparestring); if (comparenum == index) { cout << comparestring << endl; user(); found = true; } } } } if (found == false) // Error msg }