I am making a program and for that I want to take input from user. User may input a string with spaces. Also, I am not sure how many characters will user enter.
#include <iostream>
#include <string>
int main()
{
std::cout << "Enter any string at all, even if it includes spaces or is very long: " << std::flush;
std::string text;
if(std::getline(std::cin, text))
{
std::cout << "Thanks! You said \"" << text << "\"." << std::endl;
}
else
{
std::cout << "Something went wrong, I didn't quite catch that." << std::endl;
}
}