66 - Writing Custom File Structu
2018-01-10 本文已影响0人
社交帐号直接注册
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream thefile("players.txt");
cout << "enter players ID " << endl;
cout << "press ctrl+z to quit" << endl;
int idnumber;
string name;
double money;
while(cin >> idnumber >> name >> money)
{
thefile << idnumber << ' ' << name << ' ' << money << endl;
}
}