这是程序:
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
string fileName,a,b,c;
ifstream inFile;
cout<<"please input the fileName"<<endl;
cin>>fileName;
inFile.open(fileName.c_str());
inFile.ignore(200,',');
inFile>>a;
inFile.ignore(200,',');
inFile>>b;
inFile.ignore(200,',');
inFile>>c;
cout<<a<<endl<<b<<endl<<c<<endl;
inFile.close();
return 0;
}
我要读取一个文本文档中的东西:the,dog,disk,boom.break,build。要忽略逗号以及逗号前的东西
不行啊,输出还是空的。。
追答#include<iostream>看输出是什么
程序有一个错,不能运行