Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int a[101][101],n,m;
  6.  
  7. void citire()
  8. {
  9. int i,x,y;
  10. ifstream f("adiacenta1.in");
  11. while(f>>x>>y)
  12. {
  13. if(x>n)
  14. n=x;
  15. if(y>n)
  16. n=y;
  17. a[x][y]=a[y][x]=1;
  18. }
  19. f.close();
  20. }
  21. void afis()
  22. {
  23. int i,j;
  24. ofstream g("adiacenta1.out");
  25. for(i=1;i<=n;i++)
  26. {
  27. for(j=1;j<=n;j++)
  28. g<<a[i][j]<<" ";
  29. g<<endl;
  30. }
  31. g.close();
  32. }
  33. int main()
  34. {
  35. citire();
  36. afis();
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement