64,649
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <fstream>
using namespace std;
int main (){
char data;
fstream input;
input.open("abc.txt");
while(!input.eof()){
input>>data;
cout<<data<<" ";
}
input.close();
cout<<endl;
system("pause");
return 0;
}
#include <iostream>
#include <fstream>
using namespace std;
int main (){
char data;
fstream input;
input.open("abc.txt");
/*while(!input.eof()){//因为你的input输入的时候会读取两次的
input>>data;
cout<<data<<" ";
}**/
while( input >> data )
cout << data << " ";
input.close();
cout<<endl;
system("pause");
return 0;
}
//改成这样就可以了