chillurbrain

Task12_7_1

Dec 23rd, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <ctime>
  4. #include <conio.h>
  5.  
  6. using namespace std;
  7.  
  8. int* generateRandomArray(int n)
  9. {
  10.     static int* array = new int[n];
  11.     for(int i = 0; i < n; i++)
  12.         array[i] = rand() % 10;
  13.     return array;
  14. }
  15.  
  16. int main()
  17. {
  18.     const int SIZE = 10;
  19.     int* array = generateRandomArray(SIZE);
  20.     for(int i = 0; i < SIZE; i++)
  21.         cout << array[i] << " ";
  22.     delete array;
  23.     _getch();
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment