Question
C++ Write a template Array class that can accept any type of numeric data, character data or string data. The array should be dynamically created
C++
Write a template Array class that can accept any type of numeric data, character data or string data. The array should be dynamically created based on size entered by the user. Keep the class to minimum functionality needed to make your program work.
Then write the code for a recursive selection sort algorithm in a stand-alone function(s) of its own - which will take an object of your Array class and its size and sort the data within the object in descending order.
In your interactive main, prompt the user for the type of data items to be entered and ask for the number of data items of that type the array will hold. You can limit the types of data to 'int', 'char' and 'string'. If you prompt the user for the type of data, then you should prompt for all three in sequence, but also give the user to quit at any time. If you give the user a menu option for the type, then you should give the user a choice to continue with a different type or quit.
Once the program knows the type of data and number of elements, it should then get that many data items from the user. No data validation is needed - you can expect that the user will not make any error in entering the data items.
Once all the data items have been received for a type, your program should sort the data in descending order using your sort function, making sure your program or sort function prints out how the array looks at the end of every sort step.
C++
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started