1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <vector>
const char* gm_Rec_unfin = "unfin_rec.txt";
using namespace std;
struct unfinished
{
unfinished(int a0, int a1, int a2, int m, int s, int b, int o, int t,float e, bool f)
:max(m), st(s), ba(b), outs(o), tri(t), elapsed(e), fin(b) //warning: `f' is unused
{
ans[0] = a0, ans[1] = a1, ans[2] = a2;
}
int ans[3];
int max;
int st;
int ba;
int outs;
int tri;
float elapsed;
bool fin;
};
vector<unfinished> read_rec(istream & is)
{
vector<unfinished> rec;
int ans[3];
int max, st, ba, outs, tri;
float elap;
bool fini;
while (is >> ans[0] >> ans[1] >> ans[2] >> max >> st >> ba >> outs >> tri >> elap >> fini)
{
rec.emplace_back(ans[0], ans[1], ans[2], max, st, ba, outs, tri, elap, fini);
}
return rec;
}
int main(void)
{
ifstream infile(gm_Rec_unfin);
if (infile.fail()||!infile.good())
cout << "fail to read a file!" << endl;
auto unfin = read_rec(infile);
vector<unfinished>::iterator it;
for (it = unfin.begin(); it != unfin.end(); it += 1)
{
cout << it->ans[0] << it->ans[1] << it->ans[2] << "," << it->max << ","
<< it->st << "," << it->ba <<","<<it->outs<<","<<it->tri<<","
<<it->elapsed<<","<<it->fin<< endl;
}
system("pause");
return 0;
}
|