Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <ctime>
- #include <conio.h>
- using namespace std;
- int* generateRandomArray(int n)
- {
- static int* array = new int[n];
- for(int i = 0; i < n; i++)
- array[i] = rand() % 10;
- return array;
- }
- int main()
- {
- const int SIZE = 10;
- int* array = generateRandomArray(SIZE);
- for(int i = 0; i < SIZE; i++)
- cout << array[i] << " ";
- delete array;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment