大家帮我看下(文件输出问题)
题目就是打开个文件,然后读该文件并告诉里面包含多少个单词# include <iostream>
# include <fstream>
int main()
{using namespace std;
ifstream fine;
char ch[50];
cout<<"请输入";
cin.getline(ch,20);
fine.open(ch);
if(!fine.is_open)
{cout<<"coud not open the file";
cout<<"请检查";
exit(EXIT_FAILURE);
}
char tt;
int count=0;
fine>>tt;
while(fine.good())
{count++;
fine>>tt;
}
if(fine.eof)
cout<<"end of the read";
else if(fine.fail)
cout<<"unknown the file";
else if(count==0)
cout<<"none word";
cout<<count<<"words";
system("pause")
return 0;
}