Advertisement
Guest User

Untitled

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