SHARE
TWEET

Pb 37

a guest Jan 22nd, 2020 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a[10][10],v[10],i,j,x,y,n,nr=0,m;
  8. ifstream f("graf.txt");
  9. ofstream g("grafout.txt");
  10. f>>n>>m;
  11. cout<<" x= ";cin>>x;
  12. cout<<" y= ";cin>>y;
  13. for(i=1;i<=n;i++)
  14.     for(j=1;j<=n;j++)
  15.     f>>a[i][j];
  16.     for(i=1;i<=n;i++)
  17.         v[i]=0;
  18. for(i=1;i<=n;i++)
  19. {
  20.     nr=0;
  21.     for(j=1;j<=n;j++)
  22.         if(a[i][j]==1)
  23.         nr++;
  24.     v[i]=nr;
  25. }
  26. for(i=1;i<=n;i++)
  27. if(x<=v[i] && v[i]<=y)
  28. g<<i<<" ";
  29. f.close();
  30. g.close();
  31. }
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