Try:
#include <string> #include <iostream> int main() { std::string line; std::getline(std::cin, line); // read a line from std::cin into line std::cout << "Your Line Was (" << line << ")\n"; std::getline(std::cin, line); // Waits for the user to hit enter before closing the program }
source share