Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream f ("adiacenta1.in");
  5. ofstream g ("adiacenta1.out");
  6. int a[105][105];
  7. int main()
  8. {
  9. int i,j,l=0,maxi=0,y,x;
  10. while (f>>x && f>>y)
  11. {
  12. if (maxi<y)
  13. maxi=y;
  14. if (maxi<x)
  15. maxi=x;
  16. if (x!=y)
  17. {
  18. a[x][y]=1;
  19. a[y][x]=1;
  20. }
  21. }
  22. for (i=1;i<=maxi;i++)
  23. {
  24. for (j=1;j<=maxi;j++)
  25. g<<a[i][j]<<" ";
  26. g<<endl;
  27. }
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement