Advertisement
kostes

Untitled

Mar 12th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. srand(time(NULL));
  10. int n,m,i,j,x,s,a[100][100];
  11. cout<<"kol-vo strok m=";
  12. cin>>m;
  13. cout<<"kol-vo stolbcov n=";
  14. cin>>n;
  15. cout<<"elementy"<<endl;
  16. for (i=0;i<m;i++)
  17. {
  18. for (j=0;j<n;j++)
  19. {
  20. cout.width(3);
  21. a[i][j] = -10 + rand()%21;
  22. cout<<a[i][j]<<" ";
  23. }
  24. cout<<endl;
  25. }
  26. int mx=a[0][0];
  27. for(int i=0;i<m;i++)
  28. {
  29. for(int j=0;j<n;j++)
  30. {
  31. if(a[i][j]>=mx)mx=a[i][j];
  32. }
  33. }
  34. for(int i=0;i<m;i++)
  35. {
  36. for(int j=0;j<n;j++)
  37. {
  38. if(a[i][j]==mx)
  39. {
  40. cout<<"stolbec "<<j;
  41. return 0;
  42. }
  43. }
  44. }
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement