Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <array>
- #include <algorithm>
- #include <cstdlib>
- void randArray(int *&arr, int size){
- arr = new int[size];
- for (int i = 0; i < size; i++){
- arr[i]=rand()%100+1;
- }
- }
- void printArray(int *arr, int size){
- for (int i = 0; i < size; i++){
- std::cout << arr[i] << ", ";
- }
- }
- int main(){
- int *array;
- randArray(array, 20);
- printArray(array, 20);
- delete array;
- std::cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment