#include <iostream>
using namespace std;
#include <fstream>
#include <string>
int main()
{
ofstream fout("a.txt");
fout << "hello world !" <<endl;
fout.close();
string str = "";
int n=0;
double d=0.0;
char ch = 'a';
ifstream fin("a.txt");
getline(fin, str);
fin >> n >> d >> ch;
cout << "str=" << str << endl;
cout << "n=" << n << endl;
cout << "d=" << d << endl;
cout << "ch=" << ch << endl;
fin.close();
return 0;
}
I/O流
最新推荐文章于 2022-05-15 19:38:22 发布