//Ensure the CIN buffer is clear & empty from previous reads std::cin.clear(); std::cin.ignore(INT_MAX, '\r'); std::string uInpt; std::getline(std::cin, uInpt); while (uInpt.compare("quit") != 0) { std::cin.clear(); std::cin.ignore(INT_MAX, '\r'); std::cout << "You entered: " << uInpt << std::endl; std::getline(std::cin, uInpt); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)