-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBai2.cpp
More file actions
34 lines (33 loc) · 728 Bytes
/
Copy pathBai2.cpp
File metadata and controls
34 lines (33 loc) · 728 Bytes
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
#include <iostream>
#include <fstream>
using namespace std;
int main(){
fstream in, dske, dscanh;
in.open("input1.txt",ios_base::in);
dske.open("input1_1.txt",ios_base::out);
dscanh.open("input1_2.txt",ios_base::out);
int n, x;
in >> n;
dscanh << n << endl;
dske << n << endl;
int arr[n][n] = {0};
for(int i = 0;i < n;i++){
dske << i+1 << ": ";
for(int j = 0;j < n;j++){
in >> arr[i][j];
if(arr[i][j]){
if(i < j){
dscanh << i+1 << " " << j+1<< endl;
}
dske << j+1 << " ";
}
}
dske << endl;
}
//output
ifstream i1, i2;
i1.open("input1_1.txt");
i2.open("input1_2.txt");
cout << "input1_1.txt:" << endl << i1.rdbuf() << endl;
cout << "input1_2.txt:" << endl << i2.rdbuf();
}