#include
#include
#include
using namespace std;
int main()
{
ifstream fin("1.txt");
while (fin!=NULL)
{
int a;
char str[10];
fin >> a;
fin >> str;
cout << a << "+char" << str << endl;
}
}
while (fin!=NULL)
改为:
while (!fin)
如果对您有帮助,请采纳答案好吗,谢谢!
while (fin!=NULL) 修改为 while(fin.eof())
while (fin!=NULL) 改成while (fin<>NULL)