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
<string
, map
<string
, int>*> outter
;
39 for (int r1
= 0; r1
< n
; r1
++) {
40 map
<string
, int>* inner
;
41 map
<string
, map
<string
, int>*>::iterator iter
= outter
.find(values
[r1
]->at(c1
));
42 if (iter
!= outter
.end()) {
45 inner
= new map
<string
, int>();
46 outter
[values
[r1
]->at(c1
)] = inner
;
48 if (inner
->find(values
[r1
]->at(c2
)) != inner
->end()) {
49 int r2
= inner
->find(values
[r1
]->at(c2
))->second
;
52 out
<< (r2
+ 1) << " " << (r1
+ 1) << endl
;
53 out
<< (c1
+ 1) << " " << (c2
+ 1) << endl
;
56 (*inner
)[values
[r1
]->at(c2
)] = r1
;