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
Dyn is a cloud-based internet performance management company that provides DNS services for internet websites. It was attacked w
notsponge [240]

Answer: ......

Explanation: yes

8 0
2 years ago
Match the term with the appropriate definitions : Edge Computer Applications ANSWERED
WARRIOR [948]
It’s right, good luck.
7 0
1 year ago
A security administrator wants to empty the DNS cache after a suspected attack that may have corrupted the DNS server. The serve
MAVERICK [17]

Answer:

The easiest method to clear a DNS cache is to use either the command line, PowerShell or Windows Server's DNS Manager

Explanation:

You can use either the ipconfig /flushdns (command line), Clear-DnsClientCache (PowerShell) or DNS->(name)->Clear Cache (from the DNS Manager)

source:

https://activedirectorypro.com/clear-windows-dns-cache/

https://www.technipages.com/flush-and-reset-the-dns-resolver-cache-using-ipconfig

8 0
3 years ago
Read 2 more answers
Instant messaging is synchronous
ASHA 777 [7]
True; synchronous means existing or occurring at the same time (I really don't know if that's a question but oh well) 
7 0
2 years ago
Which of the following actions is most likely to be effective in reducing the digital divide at a local level? A Creating an app
Mekhanik [1.2K]

Answer: C

Explanation:

4 0
2 years ago
Other questions:
  • 12. When trying to identify the sorted column in a table, you would look for the column where A. an arrow is displayed in the fi
    10·2 answers
  • The CUSTOMERS and SALES tables contain these columns:
    6·1 answer
  • What is a difference between a waxing crescent and a waning gibbous? (1 point) waxing crescent: first quarter waning gibbous: th
    11·1 answer
  • Which describes the first step a crawler-based search engine uses to find information?
    14·2 answers
  • Giving 5 stars, a Thanks, 80 points, and Branliest to whoever answers them correctly.
    9·1 answer
  • Select the correct answer
    15·1 answer
  • Leslie’s parents put a big dry-erase board on the refrigerator and let the kids write suggestions for how to organize and assign
    14·1 answer
  • What was Ada Lovelace's contribution to computer science?
    13·2 answers
  • Think of some local businesses that have websites. Look online and identify two different websites for businesses or services in
    11·1 answer
  • What is a computer?write any four features of computer​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!