Question
C++ Include include using namespace std; Question 4. [20 marks] Write a program which keeps reading positive numbers until the input is 0 (ignored). No
C++
Include
include
using namespace std;
Question 4. [20 marks] Write a program which keeps reading positive numbers until the input is 0 (ignored). No error checking is needed. No more than 100 numbers will be entered. Print the input numbers with the tenth-place sorted in ascending order. For numbers having the same tenth-place, sort the numbers in descending order. Integers should be printed with no decimal places. Non-integers should be printed in 2 decimal places. Example 1: (user input is underlined) 123456.0 123.456 321.654 76543210 0 Sorted: 76543210 321.65 123.46 123456 Example 2: (user input is underlined) 111 222 11111 22222 0 Sorted: 11111 111 22222 222
Question 4. [20 marks] Write a program which keeps reading positive numbers until the input is 0 (ignored). No error checking is needed. No more than 100 numbers will be entered. Example 1: (user input is underlined) 123456.0 123.456 321.654 76543210 0 Sorted: 76543210 321.65 123.46 123456 Print the input numbers with the tenth-place sorted in ascending order. For numbers having the same tenth-place, sort the numbers in descending order. Integers should be printed with no decimal places. Non-integers should be printed in 2 decimal places. Example 2: (user input is underlined) 111 222 11111 22222 0 Sorted: 11111 111 22222 222
Step by Step Solution
There are 3 Steps involved in it
Step: 1
The C program that meets the specified requirements include include include include using namespace ...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