stop input with control d code example
Example: run program until ctrl-d c++
std::string line;
while (std::getline(std::cin, line))
{
std::cout << line << std::endl;
}
std::string line;
while (std::getline(std::cin, line))
{
std::cout << line << std::endl;
}