SHARE
TWEET

Untitled

a guest Sep 20th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top