Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include<cstdlib>
- #include<ctime>
- using namespace std;
- int* generateRandomArray(int n)
- {
- static int * mas=new int [n];
- srand((unsigned)time(0));
- int rnd;
- for(int i=0; i<n; i++)
- {
- rnd = (rand());
- mas[i]=rnd;
- }
- return mas;
- }
- int main()
- {
- int n;
- cin>>n;
- int * NewMas=generateRandomArray(n);
- for (int i=0;i<n;i++)
- {
- cout<<NewMas[i]<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement