2

Now these two Question are same to mine and Answers to them is For windows ctrl-z for Unix ctrl-D. But they don't work on my Clion IDE, So I am asking this Question.

c++ when will while(cin>>s) stop

How to signify no more input for string ss in the loop while (cin >> ss)

Code

#include <iostream>
int main()
{
    std::string str;
    while(std::cin>>str)
    {
    }
    return 0;
}

Works fine but I find it's just infinite loop.

Abhishek Mane
  • 619
  • 7
  • 20
  • 1
    There is some answers on this site that say you may have to press the ctrl-z or ctrl-d more than 1 time. I also found this: [http://proc-x.com/2017/06/ctrlz-does-not-generate-eof-in-windows-10/](http://proc-x.com/2017/06/ctrlz-does-not-generate-eof-in-windows-10/) – drescherjm Oct 23 '21 at 14:33

0 Answers0