Advertisement
Guest User

Untitled

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