Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. using namespace std;
  4. int *stworz(int);
  5. void wypisz(int *, int);
  6.  
  7. int main()
  8. {
  9. int a, *t;
  10. cout << "Podaj ilosc elementow w tablicy: " << endl;
  11. cin >> a;
  12.  
  13. stworz(a);
  14. t = stworz(a);
  15. cout << endl;
  16. wypisz(t, a);
  17.  
  18.  
  19. system("pause");
  20. return 0;
  21. }
  22. int *stworz(int a)
  23. {
  24. srand(time(NULL));
  25. int *n;
  26. n = new int[a];
  27. for (int i = 0; i < a; i++)
  28. {
  29. n[i] = rand() % 20 + 20;
  30. }
  31. return n;
  32. }
  33. void wypisz(int *tab, int a)
  34. {
  35. for (int i = 0; i < a; i++)
  36. {
  37. cout << tab[i] << endl;
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement