libdo

Untitled

Oct 12th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void recursiveArrayReverse(int arr[], int size)
  6. {
  7. if (size != 0)
  8. {
  9. cout << arr[size - 1] << " ";
  10. recursiveArrayReverse(arr, size - 1);
  11. }
  12.  
  13. }
  14.  
  15. int main()
  16. {
  17. int arraySize;
  18. cout << "Enter Array Size: " << endl;
  19. cin >> arraySize;
  20. int *arr = new int[arraySize];
  21.  
  22. for (int n = 0; n < arraySize; n++)
  23. {
  24. cout << "\nEnter Content Number #" << (n + 1) << endl;
  25. cin >> arr[n];
  26. }
  27.  
  28. cout << "\nReverse Order: " << endl;
  29. recursiveArrayReverse(arr, arraySize);
  30. return 0;
  31. }
Add Comment
Please, Sign In to add comment