Cin in a while loop

后端 未结 5 919
南笙
南笙 2021-01-25 08:00

So, I\'ve looked around and haven\'t been able to figure out what\'s going on with cin during my While loop. I\'m working through the book C++ Primer (5th edition) and I noticed

5条回答
  •  后悔当初
    2021-01-25 08:39

    CTRL-D works on Linux. A simpler code snippet is below:

    vector vd;
    for (double d; cin>> d;)
         vd.push_back(d);
    for(int i=0; i

提交回复
热议问题