Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cstdlib>
- #include<time.h>
- using namespace std;
- int* generujN(int N)
- {
- int* tmp;
- int i;
- srand(time(NULL));
- if (N<1)
- return 0;
- tmp=new int[N];
- for(i=0;i<N;i++)
- tmp[i]=rand()%11;
- return tmp;
- }
- int main()
- {
- int *tab;
- int i,n;
- cout << "Podaj liczbe n"<<endl;
- cin >> n;
- tab = generujN(n);
- for (i=0; i<n; ++i)
- cout<<tab[i]<< " ";
- cout<<endl;
- delete [] tab;
- return 0;
- }
Add Comment
Please, Sign In to add comment