eof problem c++

前端 未结 3 883
庸人自扰
庸人自扰 2020-12-07 03:48

i am using Dev C++ on windows xp

#include 
#include 
#include 
using namespace std;

int main ()
{
    string S         


        
3条回答
  •  感情败类
    2020-12-07 04:08

    If you change your loop to

      while(getline(infile,STRING))
      {
         cout<

    you avoid the possibility of reading the last value twice (see this SO post).

提交回复
热议问题