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
Alenkinab [10]
2 years ago
12

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. Sample Run Enter a number (1 - 10): 7↵ The Roman numeral version of 7 us VII.↵
Computers and Technology
1 answer:
hjlf2 years ago
6 0

Answer:

Below are the program for the above question:

Explanation:

#include <stdio.h>//header file.

int main()//main function.

{

   int value; //variable declaration.

   printf("Enter a number to find its roman value: ");//render a message for the user.

   scanf("%d",&value); //take a value from the user.

   switch(value)//switch case starts

   {

     case 1:

     printf("I");

     break;

     case 2:

     printf("II");

     break;

     case 3:

     printf("III");

     break;

     case 4:

     printf("IV");

     break;

     case 5:

     printf("V");

     break;

     case 6:

     printf("VI");

     break;

     case 7:

     printf("VII");

     break;

     case 8:

     printf("VIII");

     break;

     case 9:

     printf("IX");

     break;

     case 10:

     printf("X");

     break;

   }//switch case ends.

   return 0;//return statement.

}

Output:

  • If the user inputs as 4, then the output is "IV".

Code Explantion :

  • The above code is in c language, in which the scanf function is used to take the inputs from the user.
  • Then the value match from the switch case and display the suitable result.
  • And the user get the roman value from the user.

You might be interested in
You can access cloud files from any computer smart phone or tablet as long as it is connected to the Internet is it true or fals
Zepler [3.9K]

Answer:yes

Explanation:

because it is the internet

8 0
3 years ago
You are leading a project that will collect vast amounts of data, which will need processing. In your research, you learn about
Helga [31]

Answer:

Grid Computing

Explanation:

Grid computing is a processor architecture that combines computer resources from various domains to reach a main objective. In grid computing, the computers on the network can work on a task together, thus functioning as a supercomputer.

Cheers

5 0
2 years ago
Read 2 more answers
Write an expression that continues to bid until the user enters 'n'.
Sergio [31]

I've seen this problem before, you just need the solution to the 'while' loop, right?


Assuming your variable names are the same as the generic question your while loop should look like this:


while (keepGoing != 'n')

7 0
3 years ago
Which network protocol is used to handle delivery of information
rodikova [14]

Answer:

TCP

Explanation:

TCP stands for Transmission Control Protocol a communications standard that enables application programs and computing devices to exchange messages over a network. It is designed to send packets across the internet and ensure the successful delivery of data and messages over networks.

6 0
2 years ago
The class dateType was designed to implement the date in a program, but the member function setDate and the constructor do not c
san4es73 [151]

Answer:

see explaination

Explanation:

dateType.h

#ifndef dateType_H

#define dateType_H

class dateType

{

public:

void setDate(int month, int day, int year);

//Function to set the date.

//The member variables dMonth, dDay, and dYear are set

//according to the parameters.

//Postcondition: dMonth = month; dDay = day;

// dYear = year

int getDay() const;

//Function to return the day.

//Postcondition: The value of dDay is returned.

int getMonth() const;

//Function to return the month.

//Postcondition: The value of dMonth is returned.

int getYear() const;

//Function to return the year.

//Postcondition: The value of dYear is returned.

void printDate() const;

//Function to output the date in the form mm-dd-yyyy.

void isLeapYear() const;

dateType(int month = 1, int day = 1, int year = 1900);

//Constructor to set the date

//The member variables dMonth, dDay, and dYear are set

//according to the parameters.

//Postcondition: dMonth = month; dDay = day; dYear = year;

// If no values are specified, the default

// values are used to initialize the member

// variables.

private:

int dMonth; //variable to store the month

int dDay; //variable to store the day

int dYear; //variable to store the year

};

#endif

dateType.cpp

#include <iostream>

#include "dateType.h"

using namespace std;

void dateType::setDate(int month, int day, int year)

{

// Checking month is valid

while(month<1 || month>12)

{

cout << "Enterd month "<<month<< " is wrong"<<endl;

cout << "Enter correct month"<<endl;

cin>>month;

}

dMonth = month;

// Checking date is valid

while(day<1 || day>31)

{

cout << "Enterd date "<<day<<" is wrong"<<endl;

cout<<"Enter correct date"<<endl;

cin>>day;

}

dDay = day;

int count_digits = 0;

int flag=0;

int year1;

// Counting number of digits in year

while(flag==0)

{

year1=year;

count_digits=0;

while (year) {

year /= 10;

count_digits++;

}

if(count_digits != 4)

{

cout << "Enterd year "<<year1<<" is wrong"<<endl;

cout<<"Enter correct year"<<endl;

cin>>year;

flag=0;

}

else

flag=1;

}

dYear = year1;

}

int dateType::getDay() const

{

return dDay;

}

int dateType::getMonth() const

{

return dMonth;

}

int dateType::getYear() const

{

return dYear;

}

void dateType::printDate() const

{

cout << dMonth << "-" << dDay << "-" << dYear;

}

void dateType::isLeapYear() const

{

if ( dYear%400 == 0)

cout<<endl<<dYear<< " is leap year.\n";

else if ( dYear%100 == 0)

cout<<endl<<dYear<< " is leap year.\n";

else if ( dYear%4 == 0 )

cout<<endl<<dYear<< " is leap year.\n";

else

cout<<endl<<dYear<< " is not leap year.\n";

}

//Constructor with parameters

dateType::dateType(int month, int day, int year)

{

// Checking month is valid

while(month<1 || month>12)

{

cout << "Enterd month "<<month<< " is wrong"<<endl;

cout << "Enter correct month"<<endl;

cin>>month;

}

dMonth = month;

// Checking date is valid

while(day<1 || day>31)

{

cout << "Enterd date "<<day<<" is wrong"<<endl;

cout<<"Enter correct date"<<endl;

cin>>day;

}

dDay = day;

int count_digits = 0;

int flag=0;

int year1;

// Counting number of digits in year

while(flag==0)

{

year1=year;

count_digits=0;

while (year) {

year /= 10;

count_digits++;

}

if(count_digits != 4)

{

cout << "Enterd year "<<year1<<" is wrong"<<endl;

cout<<"Enter correct year"<<endl;

cin>>year;

flag=0;

}

else

flag=1;

}

dYear = year1;

}

main.cpp

#include<iostream>

#include "dateType.h"

using namespace std;

int main()

{

dateType *dt1=new dateType();

cout<<"Date is "<<endl;

dt1->printDate();

cout<<endl;

dt1->isLeapYear();

cout<<endl;

dateType *dt2=new dateType(11,14,2019);

cout<<"Date is "<<endl;

dt2->printDate();

cout<<endl;

dt2->isLeapYear();

cout<<endl;

dt2->setDate(13,32,2016);

cout<<"Date is "<<endl;

dt2->printDate();

cout<<endl;

dt2->isLeapYear();

cout<<endl;

dt1->setDate(10,10,198);

cout<<"Date is "<<endl;

dt1->printDate();

cout<<endl;

dt1->isLeapYear();

cout<<endl;

system("pause");

return 0;

}

4 0
2 years ago
Read 2 more answers
Other questions:
  • An engine you're servicing has electronically controlled cooling fans. Cooling fan 1 doesn't work but cooling fan 2 does. Which
    15·1 answer
  • âwhat two log files are used by older versions of unix and newer version of linux to store log information
    10·2 answers
  • Scratch and grinding marks on sedimentary rocks indicate which type of environment?
    6·1 answer
  • The amount of money you can charge to a credit card is called
    7·1 answer
  • The ________________ Act requires Internet sales to be treated in the same way as mail-order sales (e.g., collect sales tax from
    12·1 answer
  • WILL GIVE BRAINLEIST PLZ HELP PLZ AND THANK YOU
    7·1 answer
  • In which generation microprocessor was developed short answer of computer science​
    7·1 answer
  • Which of the following is NOT an example of editing?
    11·1 answer
  • A system that receives drawing information from electronic cad files, prepares the printing materials, and controls the size and
    12·1 answer
  • should variables that contain numbers always be declared as integer or floating-point data types? why or why not? name potential
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!