Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

using c++ Exercise 2 Write a program that asks the user to enter an array of random numbers different from zero, then sort the numbers

using c++
image text in transcribed
image text in transcribed
Exercise 2 Write a program that asks the user to enter an array of random numbers different from zero, then sort the numbers in a descending order, after that reverse it (the first element will be the last...), If the user enters as a value of a number in the array, this value should be ignored and the program should ask him to enter again a value (check the example of execution for the case of A[1]). Also, the size of the array given by the user should be checked. Below an example of execution (user's input is in red): I ************ Welcome to the sorting program Please enter the size of the array A you want to sort in descending order. -2 Please enter the size of the array A you want to sort in descending order: 5 Please enter A[0]: 2 Please enter A[i]: 0 Please enter A[1]: 0 I Please enter A[i]: 8 Please enter A[2]: 5 Please enter A[3]: 9 Please enter A[4): 1 The array A you gave and want to sort is 285 9 1 The array A sorted in a descending order: 9 8 5 2 1 Reversed sorted array A: 1 2 5 9 Note: Your codes should be well commented

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

Students explore these related Databases questions