66 - Writing Custom File Structures

#include 
#include 
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;
    }
}

你可能感兴趣的:(66 - Writing Custom File Structures)