1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Advocard [28]
2 years ago
13

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 Rom

an numeral version of that number. Input Validation: Do not accept a number less than 1 or greater than 10.
Computers and Technology
1 answer:
Studentka2010 [4]2 years ago
7 0

Answer:

// program in C++.

// headers

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// Variable

   int num;

   cout << "Enter a number between 1 and 10: ";

   // read input

   cin >> num;

   // validate input number

   while(num<1||num>10)

   {

   // if input is wrong then print error message

       cout<<"Wrong input!!Enter again:";

       // read again

       cin>>num;

   }

   // print output

   cout << "The Roman numeral for "<<num<<" is:";

   // switch

   switch (num)

   {

       case 1:

       // if input is 1

           cout<<"I"<<endl;

           // exit the switch

           break;

       case 2:

       // if input is 2

           cout<<"II"<<endl;

           // exit the switch

           break;

       case 3:

       // if input is 3

           cout<<"III"<<endl;

           // exit the switch

           break;

       case 4:

       // if input is 4

           cout<<"IV"<<endl;

           // exit the switch

           break;

       case 5:

       // if input is 5

           cout<<"V"<<endl;

           // exit the switch

           break;

       case 6:

       // if input is 6

           cout<<"VI"<<endl;

           // exit the switch

           break;

       case 7:

       // if input is 7

           cout<<"VII"<<endl;

           // exit the switch

           break;

       case 8:

       // if input is 8

           cout<<"VIII"<<endl;

           // exit the switch

           break;

       case 9:

       // if input is 9

           cout<<"IX"<<endl;

           // exit the switch

           break;

       case 10:

       // if input is 10

           cout<<"X"<<endl;

           // exit the switch

           break;

         // default

       default:

           break;

   }

return 0;

}

Explanation:

Read a number from usr and assign it to variable "num". If the input number is less than 1 or greater than 10 then ask again to enter a number until user  enter a number between 1-10 only.Then with the help of switch() function print  the equivalent Roman number.

Output:

Enter a number between 1 and 10: -5                                                                                        

Wrong input!!Enter again:12                                                                                                

Wrong input!!Enter again:6                                                                                                

The Roman numeral for 6 is:VI

You might be interested in
To move an icon, you right-click it and select “Pin to start menu.” True False
tester [92]

"To move an icon, you right-click it and select “Pin to start menu.” True False"

False

4 0
2 years ago
Read 2 more answers
To run a PHP application that has been deployed on your own computer you can enter a URL in the address bar of your browser that
svet-max [94.6K]

Answer:

You can enter a URL that (B) Uses localhost as the domain name

Explanation:

Localhost refers to your computer or the computer that is currently in use.

To run a PHP application that is deployed on your computer, the localhost (which has an IP address of 127.0.0.1) is used.

The IP address is called a "loopback" address because all data sent or received revolve around the local computer.

8 0
3 years ago
When I click on someone who asked a question and i want to see there answer it is always blurred and when I asked a question I c
yuradex [85]

Answer:

If your on pc like me use ad blocker I do that but otherwise watch the add press ok after if it dosemt work tell me I’ll try and find you it and for ad blocker you also can have a jailbreak divice and to get and blocker go to chrome extension website search up pop up ad blocker

Explanation:

7 0
3 years ago
If ADD = 81, BAD = 49, and CAD = 64, then what is the value of ACA?
Digiron [165]

Answer:

its 72

Explanation:

i know it because i did it and thats how i know it

6 0
2 years ago
 What should every Software Engineer know about Software Architecture? ”<br> ??
Llana [10]
<span>Answer: -Software architecture isn't about big design up front; -Every software team needs to consider software architecture; -The software architecture role is about coding, coaching and collaboration; -You don't need to use UML; -A good software architecture enables agility.</span>
7 0
3 years ago
Other questions:
  • List the data types that are allowed for SQL attributes.
    7·1 answer
  • A programmer wrote the code segment below to display the average of all the elements in a list called numbers. There is always a
    8·1 answer
  • Which of the following is an example of a good listening skill? A. Replying to the caller as "you" rather than using his or her
    9·2 answers
  • The 3 parts of the CPU are
    15·2 answers
  • Suppose we provide a new implementation of the transport layer protocol tcp providing the same functionality using different alg
    14·1 answer
  • Using C++
    15·1 answer
  • What is gender bias?
    9·1 answer
  • What does RFID use for wireless communication?<br> Infrared<br> IoT<br> Smart chip<br> Tag
    14·1 answer
  • 1. Write a method to measure sortedness of an array. The method header is:
    14·1 answer
  • Q.No.3 b. (Marks 3)
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!