Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream f ("atestat.in");
- ofstream g ("atestat.out");
- int n,M[11][11];
- void citire()
- {
- f>>n;
- int x,y;
- while (f>>x>>y)
- {
- M[x][y]=M[y][x]=1;
- }
- }
- void a()
- {
- for(int i=1;i<=n;i++)
- {
- for (int j=1;j<=n;j++)
- cout<<M[i][j]<<" ";
- cout<<endl;
- }
- }
- void b()
- {
- int v,c=0;
- cin>>v;
- for(int i=1;i<=n;i++)
- {
- if(M[v][i])
- c++;
- }
- cout<<c;
- }
- void c()
- {
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=n;j++)
- {
- if(M[i][j]==0 && i!=j)
- M[i][j]=1;
- g<<M[i][j]<<" ";
- }g<<endl;
- }
- }
- int main()
- {citire();
- a();
- b();
- c();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement