美文网首页
66 - Writing Custom File Structu

66 - Writing Custom File Structu

作者: 社交帐号直接注册 | 来源:发表于2018-01-10 14:05 被阅读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;
    }
}

相关文章

网友评论

      本文标题:66 - Writing Custom File Structu

      本文链接:https://www.haomeiwen.com/subject/uhronxtx.html