Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- int *stworz(int);
- void wypisz(int *, int);
- int main()
- {
- int a, *t;
- cout << "Podaj ilosc elementow w tablicy: " << endl;
- cin >> a;
- stworz(a);
- t = stworz(a);
- cout << endl;
- wypisz(t, a);
- system("pause");
- return 0;
- }
- int *stworz(int a)
- {
- srand(time(NULL));
- int *n;
- n = new int[a];
- for (int i = 0; i < a; i++)
- {
- n[i] = rand() % 20 + 20;
- }
- return n;
- }
- void wypisz(int *tab, int a)
- {
- for (int i = 0; i < a; i++)
- {
- cout << tab[i] << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement