RafalSobala

tablice zad 12

Apr 19th, 2020
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. int w=0,k=0;
  8.  
  9.  
  10. int fool(int tab,int w,int k)
  11. {
  12.     int a=1,b=100;
  13.     for(int i=0;i<w;i++){
  14.         for(int j=0;j<k;j++){
  15.             tab[i][j]=a+rand()%(b-a+1);
  16.         }
  17.     }
  18. }
  19.  
  20.  
  21. int main()
  22. {
  23.     srand(time(NULL));
  24.     int tab[w][k];
  25.  
  26.     cout << "Podaj ilosc wierszy: " << endl;
  27.     cin >> w;
  28.     cout << "Podaj ilosc kolumn: " << endl;
  29.     cin >> k;
  30.  
  31.  
  32.     fool(tab,w,k);
  33.  
  34.     return 0;
  35. }
Add Comment
Please, Sign In to add comment