-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
104 lines (104 loc) · 2.01 KB
/
main.cpp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//#include<iostream>
//#include<string.h>
//#include<string>
//#include<cstdlib>
//#include<fstream>
//#define SIZE 40000
//#define BOUND 10000
//int Count = 0;
//
//float record[SIZE][12];
//bool visited[SIZE];
//
//using namespace std;
//
//int main(){
// ifstream file("C:\\Users\\root\\Desktop\\final_test\\card_final_test2.txt",ios::in|ios::binary);
// if (!file){
// cout << "open failed";
// return 0;
// }
// memset(visited, false, SIZE);
// string s;
// while (getline(file, s)){
// //parse data
// float money;
// int year;
// int mon;
// int id = atoi(s.c_str());
// int p = 0;
// int q;
//
// for (int c=0; p < s.length(); p++){
// if (s[p] == ',') c++;
// if (c == 4) break;
// }
// if (p != s.length()){
// p += 2;
// char tmp[5];
// for (int i = 0; i < 4; i++){
// tmp[i] = s[p + i];
// }
// tmp[4] = 0;
// year = atoi(tmp);
// if (year == 2014){
// p += 5;
// }
// else continue;
//
// for (int i = 0; i < 2; i++){
// tmp[i] = s[p + i];
// }
// tmp[2] = 0;
// mon = atoi(tmp);
//
// for (int c=0; p < s.length(); p++){
// if (s[p] == ',') c++;
// if (c == 2)break;
// }
// if (p != s.length()){
// p += 2;
// q = p;
// while (s[q] != '\"') q++;
// money = atof(s.substr(p, q).c_str());
//
// visited[id] = true;
// record[id][mon-1] += money;
// Count++;
//// if (Count == BOUND) break;
//// cout << id << ' ' << mon << ' ' << money << endl;
// }
// }
//
// }
//
// //output
// //int p = 0;
// //int c = 0;
// //while (1){
// // if (p == SIZE) break;
// // if (visited[p] == true){
// // for (int i = 0; i < 12; i++){
// // cout << record[p][i] << ' ';
// // }
// // cout << endl;
// // c++;
// // }
//
// // p++;
// //}
//
// ofstream of("C:\\Users\\root\\Desktop\\final_test\\output\\card2014.txt", ios::out);
// for (int i = 0; i < SIZE; i++){
// if (visited[i] == true){
// of << i << ' ';
// for (int j = 0; j < 12; j++){
// of << record[i][j] << ' ';
// }
// of << endl;
// }
// }
//
// of.close();
// file.close();
//}