Question: Question 4 : Define the following constants: const int FLOOR _ ROUND = 1 ; const int CEILING _ ROUND = 2 ; const int

Question 4:
Define the following constants:
const int FLOOR_ROUND =1;
const int CEILING_ROUND =2;
const int ROUND =3;
Write a program that asks the user to enter a Real number, then it asks the user to enter the method by which they want to round that number (floor, ceiling or to the nearest integer). The program will then print the rounded result.
Your program should interact with the user exactly as it shows in the following example: Please enter a Real number:
4.78
Choose your rounding method:
Floor round
Ceiling round
Round to the nearest whole number
2
5
Implementation requirements:
Use a switch statement.
You are not allowed to include and use the math library.
 Question 4: Define the following constants: const int FLOOR_ROUND =1; const

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To achieve this you can write a C program that uses a switch statement to handle the rounding methods Below is a possible implementation cpp include const int FLOORROUND 1 const int CEILINGROUND 2 const int ROUND 3 int main double number int method stdcout Please enter a Real number stdcin number stdcout Choose your rounding method ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!