Michal_Pilarski

zad11 tablice

Apr 17th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6. float tabA[5];
  7. float tabB[5];
  8. float tabC[5];
  9. int a;
  10.  
  11. int main()
  12. {
  13.     srand(time(NULL));
  14.     cout << "Podaj zakres liczb losowych" << endl;
  15.     cout<<"Od zera do: ";
  16.     cin >> a;
  17.     cout<<"Suma dwoch tablic z liczbami losowymi"<<endl;
  18.     for(int i=0; i<5; i++)
  19.     {
  20.         tabA[i] = tabA[i] + rand()%a;
  21.         tabB[i] = tabB[i] + rand()%a;
  22.         tabC[i] = tabA[i] + tabB[i];
  23.         cout<<tabC[i]<<endl;
  24.     }
  25.  
  26.     return 0;
  27. }
Add Comment
Please, Sign In to add comment