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]
3 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]3 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
What did do you do if you made a mistake on a computer?
Andrej [43]
Get ADW cleaner, and ccleaner. It will work on almost any bug. It basicley wipes out cache (ccleaner), and cleans ad ware off your device (ADW). If it is something else email, a snap shot of your problem. My email is, [email protected] Rate me crown me thank me. If it really helped, crown me. If it helped, thank me. Rate me, and comment.
5 0
3 years ago
Read 2 more answers
There are many modes of remote visual communication. which is the most common mode
Veronika [31]
The answer is mobile communication, this consists of emails, texts, and parts of social media (Ex. DM's)
7 0
3 years ago
How does the post process alert the user if it detects a hardware problem during the post process?
Lesechka [4]
As a Alert down by the bar under where it says start I would think.
6 0
3 years ago
To create a cover letter to send to potential employers along with a resume, what software program should you use ?
UkoKoshka [18]
I personally would use Word because it has the potential to create the cover letter and attach a resume along with it. 

Excel is more for tables and creating an organized way to see your recordings. 

PowerPoint is known for presentations mainly.

Twitter is a type of social media platform that is useful in communication. 
4 0
3 years ago
Read 2 more answers
Which object waits for and responds toan event from a GUI component?
irakobra [83]

Answer:

The answer is action eventlistener

Explanation:

It is an event handler and it is easy to implement.In java we call them even listeners it is function or a sub routine or a procedure that waits for an event to occur and respond to an event from a GUI component.

8 0
3 years ago
Other questions:
  • Consider the following method:
    8·2 answers
  • To increase the view of a document on the screen, use the _____. View icon Zoom slider full-screen reading boldface font
    9·1 answer
  • What are some ways tables can be inserted into a document? Check all that apply.
    5·2 answers
  • 2. Given the following list, write a snippet of code that would print the individual elements of the list using the indexes of t
    13·1 answer
  • Explain how the operating system controls the software and hardware on the computer?
    5·1 answer
  • Some websites are dedicated to cataloguing information. Since these sites contain so much data, these sites are usually organize
    11·2 answers
  • What games do you play?<br><br><br> Be sure not to report any answers!
    5·1 answer
  • An article explaining the uses of the parts of a computer​
    14·1 answer
  • A specialized output device for producing charts, maps, and very high-quality drawings is
    5·1 answer
  • Which of these are examples of an access control system? Check all that apply.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!