-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdataBuild.cpp
111 lines (111 loc) · 2.28 KB
/
dataBuild.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
105
106
107
108
109
110
111
//#include<fstream>
//#include<iostream>
//#include<string>
//#include<stdio.h>
//#include<sstream>
//#define SIZE 40000
//#define SUBSIDY "C:\\Users\\root\\Desktop\\¾«×¼×ÊÖú\\train\\subsidy_train.txt"
//#define CARD "C:\\Users\\root\\Desktop\\¾«×¼×ÊÖú\\output_train\\card"
//#define OUTFILE "C:\\Users\\root\\Desktop\\¾«×¼×ÊÖú\\output_train\\test_data.txt"
//
//using namespace std;
//int record[SIZE][13];
//bool visited[SIZE];
//int getSubStr(string s, char arr[], int beg);
//
//int main(){
// ifstream subsidy(SUBSIDY, ios::in | ios::binary);
// string s;
// int id;
// memset(visited, false, SIZE);
//
// if (!subsidy){
// cout << "subsidy open err" << endl;
// return 0;
// }
//
// while (getline(subsidy, s)){
// id = atoi(s.c_str());
// size_t p = s.find(',') + 1;
// int count = s.length() - p;
// int money = atoi(s.substr(p, count).c_str());
// switch (money){
// case 0:
// record[id][12] = 0;
// break;
// case 1000:
// record[id][12] = 1;
// break;
// case 1500:
// record[id][12] = 2;
// break;
// case 2000:
// record[id][12] = 3;
// break;
// }
// }
// subsidy.close();
//
// //input card mess
// for (int a = 3,base = 0; a <= 4; a++){
// stringstream ss;
// ss << CARD << a << ".txt";
// ifstream card;
// card.open(ss.str(), ios::in | ios::binary);
// if (!card){
// cout << "card open err" << endl;
// return 0;
// }
//
// char tmp[10];
// while (getline(card, s)){
// int p = 0;
// p = getSubStr(s, tmp, p);
// id = atoi(tmp);
// visited[id] = true;
// for (int i = 0; i < 6; i++){
// p = getSubStr(s, tmp, p);
// record[id][base+i] = atof(tmp);
// }
// }
//
// base += 6;
// card.close();
// }
//
// //output
// fstream of(OUTFILE, ios::out);
// for (int i = 0; i < SIZE; i++){
// if (visited[i]){
// int cnt = 0;
// for (int j = 0; j < 12; j++){
// if (record[i][j] == 0) cnt++;
// }
// if (cnt >= 6) continue;
//
// of << i << ' ';
// for (int j = 0; j < 13; j++){
// of << record[i][j] << ' ';
// }
// of << endl;
// }
// }
//
// of.close();
//}
//
//int getSubStr(string s,char arr[], int beg){
// int i = 0;
// while (s[beg + i] != '\0'){
// if (s[beg + i] == ' '){
// arr[i] = '\0';
// return beg + i + 1;
// }
// else{
// arr[i] = s[beg + i];
// }
// i++;
// }
// arr[i] = '\0';
// return i;
//}