Guest User

16.12.13

a guest
Dec 16th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.  
  10. srand (time(0));
  11. int tab[5][10];
  12. int k, l, x, w, n;
  13.  
  14. cout<<"Tablica 5 x 10:\n\n";
  15.  
  16. for (k=0; k<=4; k++)
  17.     {
  18.         cout<<"\t";
  19.         for (l=0; l<=9; l++)
  20.             {
  21.                 tab[k][l]=rand()%101;
  22.                 cout<<tab[k][l]<<" ";
  23.             }
  24.         cout<<endl;
  25.     }
  26.  
  27. cout<<"\n\nPodaj nr kolumny (od 1 do 10):\n";
  28. cin>>x;
  29. x=x-1;
  30.  
  31. for (n=0; n<=4; n++)
  32. {
  33.     if (tab[n][x]>=tab[n+1][x]) w=tab[n][x];
  34.     else w=tab[n+1][x];
  35.    
  36. }
  37.  
  38. cout<<"\nnajwieksza wartosc dla podanej kolumny wynosi: "<<w;
  39.     return 2013;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment