Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n;
  7. cout << "Wprowadź ilość liczb do wylosowania: ";
  8. cin >> n;
  9. int tab[n];
  10. int zakres = 50 + 38 + 1; // max - min + 1
  11. srand(time(NULL));
  12. for(int i=0; i<n; i++) {
  13. tab[i] = (rand() % zakres - 38);
  14. }
  15. for(int i=0; i<n; i++) {
  16. cout << "tab[" << i << "] = " << tab[i] << endl;
  17. }
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement