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
You are a running cable in a new network. You are running a series of cables from the wiring closet to the RJ-45 ports for the c
siniylev [52]

Answer:

IDF cable

Explanation:

An IDF cable or intermediate distribution frame is a cable rack that interconnects and manages a MDF or main distribution frame and a collection of workstations or computer systems. The MDF is a cable rack that interconnects several IDFs to itself.

4 0
2 years ago
A __________is a software program that appears to be a physical computer and executes programs as if it were a physical computer
svlad2 [7]

Answer:

Virtual Machine

Explanation:

<em> I had to look this up, since there were no options from the question. If this is wrong, let me know!</em>

8 0
2 years ago
10^4+10-2=<br>10^4+10-2=
yaroslaw [1]
10008 is the answer to your question
4 0
3 years ago
Read 2 more answers
Im Gonna Give Brainly a Second Chance<br><br> Everybody deserves a second chance
Nady [450]

Answer:

ok I know it's not for me but for who?

Explanation:

Just asking. And yes everyone deserves a second chance. Even liars?

please don't take my question wrongly have an above average day!

7 0
3 years ago
Read 2 more answers
Using functions,
ZanzabumX [31]

Answer:

See explaination

Explanation:

#include <iostream>

using namespace std;

int main()

{

double h, w;

int s, a, b;

cout<<"height in feet: ";

cin>>h;

cout<<"width in feet: " ;

cin>>w;

cout<<"tile size in inches:";

cin>>s;

int height = h*12;

if(height%s==0)

a = height/s;

else

a = height/s + 1;

int width = w*12;

if(width%s==0)

b = width/s;

else

b = width/s + 1;

cout<<"Number of tiles: "<<a*b;

}

8 0
3 years ago
Other questions:
  • 20 points/ When creating a storyboard, in which section do you mention how you move from one shot to the next?
    11·1 answer
  • What microprocessor was the first to be processable<br> ?
    14·1 answer
  • What action makes RAM on your computer disappear?
    12·2 answers
  • The ________ contains the central electronic components of the computer. select one:
    14·1 answer
  • Over the past three hours the pressure has been steadily increasing at a rate of what
    6·1 answer
  • Help!!!! ASAP TIMED TEST 50 points!!!!
    7·1 answer
  • What steps might a company or organization need take in order to keep its digital data secure online?
    8·1 answer
  • You are an IT technician at your company. The company has two small offices in different cities. The company's head office conta
    5·1 answer
  • True or false? The following deterministic finite-state automaton recognizes the set of all bit strings such that the first bit
    7·1 answer
  • Find different between manocots and dicots clarify with example​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!