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
Hayne is starting his own business as a psychotherapist and needs to post a website advertising his services,contact information
irina1246 [14]

The kind of website which would best suit Hayne's needs is a: C) Dynamic website.

A website is the collective name that is used to describe series of interconnected webpages having a unique domain name.

Basically, a website is an HTML document which comprises codes, tags, images, audios, and videos that are integrated to make them responsive and interactive with clients (end users).

In Computer and Technology, there are four (4) main types of website and these include:

  • Static website.
  • E-commerce website.
  • Scripted website.
  • Dynamic website.

A dynamic website is a type of website which is designed to contain information that automatically changes based on the client, time zone, time of the day, language, services, and other factors.

In this scenario, the kind of website which would best suit Hayne's needs is a dynamic website because his services, tips or contact information may change.

Read more: brainly.com/question/21694571

7 0
3 years ago
John's boss asks for a recommendation for connecting the company network to a small satellite building about 1 km from the main
tresset_1 [31]

Answer:

C. Ethernet over multi mode fiber .

Explanation:

Given that the distance to be covered is 1 km. Multi-mode optic fiber is best suited for short distances of up to 2 km and can withstand harsh environments with less signal attenuation. Single mode fiber is best suited long distance of up to 200 km or more and is expensive as compared to multi-mode fiber Ethernet over twisted pair is best for indoor use and can only cover very short distances. Although UTP and STP are relatively cheap they cannot withstand harsh environments without great signal loss.

4 0
4 years ago
What is data and instructions entered into the memory of a device
lyudmila [28]

A POINTING DEVICE IS AN INPUT DEVICE THAT ALLOWS A USER TO CONTROL A POINTER ON THE SCREEN. ... A KEYBOARD IS AN INPUT DEVICE THAT CONTAINS KEYS USER TO ENTER DATA AND INSTRUCTIONS INTO A COMPUTER.                                                                            

SORRY FOR CAPS MY CAPS KEY GOT STUCK

3 0
4 years ago
Holly needs to create an online survey to find out what people want and is
Dahasolnce [82]

Answer:

The correct answer is (A).The server application will allow the customers to select their  answers on the survey.

Explanation:

Since Holly needs to design an online survey which is a web based application, in finding out what people need or want, In this process, the role or function of the server is to enable customers to select their own choice of answers on the survey that will be created online.

4 0
4 years ago
15.Every CPU needs to:
aliya0001 [1]

Answer:

Dissipate heat

Explanation:

As CPU works efficiently while there is cool

8 0
3 years ago
Other questions:
  • Mile markers appear as _____ green signs.
    6·2 answers
  • Can someone fix this so that it only says "its a payday" on 15 and 30 and on all other days "sorry, it's not payday"
    9·1 answer
  • The flowchart shape for input or output is an oval. <br> a. True <br> b. False
    6·1 answer
  • Required
    12·1 answer
  • Write the definition of a function printLarger, which has two int parameters and returns nothing. The function prints the larger
    7·1 answer
  • Unicode is a world standard to represent _________________
    10·1 answer
  • In most programming languages, the compiler carries a preprocessing step to determine if certain statements will compile. For in
    7·1 answer
  • A reflective cross-site scripting attack (like the one in this lab) is a __________ attack in which all input shows output on th
    14·1 answer
  • To execute a command object and store the results in a dataset, you use the Group of answer choices Fill method of a data adapte
    5·1 answer
  • An engine that generates hot, expanding gases by burning fuel inside the machine.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!