Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- #include <fstream.h>
- int a[20][20];
- int main (){
- int i,j,k,n,x,y;
- ifstream f("in.txt");
- f>>n;
- for(i=1;i<=n;i++)
- for(j=1;j<=n;j++)
- f>>a[i][j];
- for(k=1;k<=n;k++)
- for(i=1;i<=n;i++)
- for(j=1;j<=n;j++)
- if(!a[i][j] && a[i][k] && a[k][j] && i!=k && j!=k)
- a[i][j]=1;
- for(i=1;i<=n;i++){
- for(j=1;j<=n;j++)
- cout<<a[i][j]<<" ";
- cout<<endl;
- }
- k=1;
- for(i=1;i<=n && k;i++){
- for(j=1;j<=n && k;j++)
- if(i!=j && a[i][j]!=1)
- k=0;
- }
- if(k)
- cout<<"este tare tare foarte tare conex";
- else
- cout<<"nu este tare tare foarte tare conex";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement