Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

what is wrong with this? Write a program that asks the user to enter a number within the range of 1 through 10. Use a

what is wrong with this?

Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to display the Roman numeral version of that number.

Input Validation: Do not accept a number less than 1 or greater than 10.

Prompts And Output Labels. Use the following prompt for input: "Enter a number (1 - 10): ". The output of the program should be of the form "The Roman numeral version of A is R" where A is the Arabic numeral entered (1,2,3,...) and R is the all-capitals form of a Roman numeral, such as VII.

#include #include using namespace std;

int main(){

int number;

cout<<"Enter a number (1 - 10): ";

cin>> number;

while (number < 1 || number > 10){

cout<<"Please enter a valid number"<

cin>>number; }

switch (number){

case 1:cout<<"The Roman numeral version of "<

break; case 2:cout<<"The Roman numeral version of "<

break;

case 3:cout<<"The Roman numeral version of "<

break; case 4:cout<<"The Roman numeral version of "<

break;

case 5:cout<<"The Roman numeral version of "<

break;

case 6:cout<<"The Roman numeral version of "<

break;

case 7:cout<<"The Roman numeral version of "<

break;

case 8:cout<<"The Roman numeral version of "<

break;

case 9:cout<<"The Roman numeral version of "<

break;

case 10:cout<<"The Roman numeral version of "<

break;

default: cout<<"Invalid entry."; }

return 0;

}

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

More Books

Students also viewed these Databases questions