Write a program that should ask the user to input 12 elements (positive whole numbers) inside the array and then it will sort the even numbers in ascending order and odd numbers in descending order. If the user's input is not a positive whole number, then prompt "ERROR! Please input a positive whole number only. Sample Output: Input: 1 18 15 17 14 25 30 77 48 52 64 89 Even Numbers: 14 18 30 48 52 64 Odd Numbers: 89 77 25 17 15 1

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 22PE
icon
Related questions
Question
100%

Write a program that should ask the user to input 12 elements (positive whole numbers) inside the array and then it will sort the even numbers in ascending order and odd numbers in descending order. If the user's input is not a positive whole number, then prompt "ERROR! Please input a positive whole number only.

Sample Output:

Input: 1 18 15 17 14 25 30 77 48 52 64 89

Even Numbers: 14 18 30 48 52 64

Odd Numbers: 89 77 25 17 15 1

Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning