33,311
社区成员
发帖
与我相关
我的任务
分享
#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream in_file("C:\Users\1008633083\Desktop\file\file.txt");
if (in_file.fail())
cout<<"Bad file.\n";
else{
int vali=0;
double vald=0;
char valc[50];
in_file >> vali >> vald >> valc;
cout << "Integer number in file: " << vali << endl;
cout << "Floating number in file: " << vald << endl;
cout << "Character in file: " << valc << endl;
in_file.close();
}
return 0;
}
ifstream in_file("C:\\Users\\1008633083\\Desktop
\\file\\file.txt");