Question: // Switch wont return a value #include #include using namespace std; int main() { int realNumber, choice; // screen I/O cout < < Please enter
// Switch wont return a value
#include
#include
using namespace std;
int main()
{
int realNumber, choice;
// screen I/O
cout << "Please enter a Real number: ";
cin >> realNumber;
cout << "Choose your rounding method: ";
cout << "1. Floor round ";
cout << "2. Ceiling round ";
cout << "3. Round to the nearest whole number ";
cin >> choice;
switch (choice)
{
case 1: cout << floor(realNumber);
break;
case 2: cout << ceil(realNumber);
break;
case 3: cout << round(realNumber);
break;
default: cout << endl;
}
return 0;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
