10 ifstream in
; in
.open("database.in");
11 ofstream out
; out
.open("database.out");
19 vector
<vector
<string
>*> values
;
20 for (int i
= 0; i
< n
; i
++) {
22 vector
<string
>* row
= new vector
<string
>();
24 for (int j
= 0; j
< m
- 1; j
++) {
25 in
.getline(buffer
, sizeof(buffer
) / sizeof(char), ',');
26 row
->push_back(buffer
);
29 in
.getline(buffer
, sizeof(buffer
) / sizeof(char), '\n');
30 row
->push_back(buffer
);
32 values
.push_back(row
);
35 for (int c1
= 0; c1
< m
; c1
++) {
37 for (int c2
= c1
+ 1; c2
< m
; c2
++) {
38 map
<pair
<string
, string
>, int> map
;
39 for (int r1
= 0; r1
< n
; r1
++) {
40 string s1
= values
[r1
]->at(c1
);
41 string s2
= values
[r1
]->at(c2
);
42 pair
<string
, string
> s(s1
, s2
);
43 if (map
.find(s
) != map
.end()) {
44 int r2
= map
.find(s
)->second
;
47 out
<< (r2
+ 1) << " " << (r1
+ 1) << endl
;
48 out
<< (c1
+ 1) << " " << (c2
+ 1) << endl
;