Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- void beolvasas(int mat[][2], int&n, int& m ) {
- ifstream fin("ellista.txt");
- fin >> n >> m;
- for (int i = 0; i < m; i++) {
- fin >> mat[i][0] >> mat[i][1];
- }
- }
- void ellista_kiiratas(int mat[][2],int m) {
- for (int i = 0; i < m; i++) {
- cout << mat[i][0] << ' ' << mat[i][1] << endl;
- }
- }
- void pp_mat_tolt(int mat[][2],int pp_mat[][50], int m) {
- for (int i = 0; i < m; i++) {
- pp_mat[mat[i][0]-1][mat[i][1]-1] = 1;
- }
- }
- void ki_pp_mat(int pp_mat[][50], int n) {
- int i, j;
- for (i = 0; i < n; i++) {
- for (j = 0; j < n; j++)
- cout << pp_mat[i][j] << ' ';
- cout << endl;
- }
- }
- int main()
- {
- int mat[50][2], n, m;
- beolvasas(mat,n,m);
- ellista_kiiratas(mat, m);
- cout << endl << endl;
- int pp_mat[50][50] = {};
- pp_mat_tolt(mat,pp_mat,m);
- ki_pp_mat(pp_mat,n);
- }
Advertisement
Add Comment
Please, Sign In to add comment