Advertisement
Guest User

Hshs

a guest
Feb 19th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. //formarea matricii de incidenta
  2.  
  3. #include <iostream>
  4.  
  5. #include <fstream>
  6.  
  7. using namespace std;
  8.  
  9. int n,m,a[100][100],i,j,x,y;
  10.  
  11. ifstream f("date.in");
  12.  
  13. int main()
  14.  
  15. {
  16.  
  17. f>>n>>m;
  18.  
  19. for(i=1;i<=m;i++)
  20.  
  21. {f>>x>>y;
  22.  
  23. a[x][i]=-1;
  24.  
  25. a[y][i]=1;
  26.  
  27. }
  28.  
  29. for(i=1;i<=n;i++)
  30.  
  31. {for(j=1;j<=m;j++)
  32.  
  33. cout<<a[i][j]<<' ';
  34.  
  35. cout<<endl;}
  36.  
  37. return 0;
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement