Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4. int a[10][10],d[10],m,n;
  5.  
  6. std::ofstream out("date.out");
  7.  
  8. void construire()
  9. {
  10. std::ifstream in("date.in");
  11. in>>n;
  12. in>>m;
  13. int x,y;
  14. for(int i=1;i<=m;i++)
  15. {
  16. in>>x>>y;
  17. a[x][y]=1;
  18. a[y][x]=1;
  19. d[x]++;
  20. d[y]++;
  21. }
  22. in.close();
  23. }
  24.  
  25. void afisare()
  26. {
  27. for(int i=1;i<=m;i++)
  28. {
  29. for(int j=1;j<=n;j++)
  30. {
  31. out<<a[i][j]<<" ";
  32. }
  33. out<<endl;
  34. }
  35. out<<endl;
  36. for(int j=1;j<=n;j++)
  37. {
  38. out<<d[j]<<" ";
  39. }
  40. }
  41. int main()
  42. {
  43. construire();
  44. afisare();
  45. out.close();
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement