[Solved] Is there a way in c++ to make it so that the program runs as long as there are new values introduced? [closed]


The std::cin method from the iostream library returns true when it can read an input and false when it tries to read but there’s nothing more to read. So you can use while(cin >> bar) and it will read input until it finds an EOF character (either from you pressing CTRL+D in the console or from reaching the end of a file redirected to stdin)

solved Is there a way in c++ to make it so that the program runs as long as there are new values introduced? [closed]