Description
Write a C++ program that does the following :
1. Accepts array size from the keyboard. Size must be a positive integer that
is >= 10 and <= 1000.
2. Use the size from step 1 in order to create an integer array. Populate the
created array with random integer values between 10 and 1000
inclusive
3. Display the first 10 elements of the generated array.
4. Write a function that uses recursion in order to display squares of
integers in ascending order, starting from 1 to last number in the array.
5. Write a function that uses recursion to raise a number to a power. The
function should take two arguments, the number to be raised to the
power is the first number in array and the power is 2.
6. Write a recursive function that returns the maximum elements in the
array
7. Using quick sort , write a function that uses recursion to sort the array in
descending order. Calculate and print the CPU time before each step
starts and after each completed step then calculate actual CPU time for
the completion of each step. Use the last value as a pivot value.
8. Write a recursive function that that takes an integer ( first number in the
sorted arrays ) as a parameter and returns the sum of digits of that
integer.
Spring 2018 – Husain Gholoom – Lecturer in Computer Science
1CS3358 – Data Structures
Programming Assignment 5
9. Write a recursive function that determines whether or not every number
in the sorted array is a prime number.
The program displays a menu on the screen allowing the user to enter the a
choice to enter the size of an array or to terminate the program.
NOTES:
•
•
•
•
Just one .cpp file with at least 6 individual recursive functions plus main for
testing.
Do not use global variable , arrays … etc.
Validation on the menu selection and the array size.
Replace My name (Husain Gholoom) with your first and last name.