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
xxTIMURxx [149]
4 years ago
7

Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of

the week, where 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday, and 7 = Sunday. The program should display an error message if the user enters a number that is outside the range of 1 through 7.
Computers and Technology
1 answer:
Tasya [4]4 years ago
8 0

Answer:

#include <iostream>

using namespace std;

int main()

{

int day;

cout<<"Enter a number for the day of the week"<<endl;

cin>> day;

switch (day) {

case 1: cout << "Monday"<< endl; break;

case 2: cout << "Tuesday" << endl; break;

case 3: cout << "Wednesday" << endl; break;

case 4: cout << "Thursday" << endl; break;

case 5: cout << "Friday" << endl; break;

case 6: cout << "Saturday" << endl; break;

case 7: cout << "Sunday" << endl; break;

default: cout<<"Error, You entered an invalid day"<<endl;

}

   return 0;

}

Explanation:

The program is written using a switch statement in C++ programming language. we start off by creating a variable day of type integer, which is received using the cin statement. We then use switch statement to test the value using the conditions stated in the question. We use the default statement which acts like an else  statement to handle the an invalid situation

You might be interested in
What is the condition for setting an alarm clock
stich3 [128]

Answer:

The time in which the alarm clock will sound

Explanation: Hope this helped please give me brainliest

6 0
3 years ago
Which of these statements about PNG is true?
Amiraneli [1.4K]

Answer:

d

Explanation:

6 0
3 years ago
Read 2 more answers
If a user wants to add an expansion card to increase the memory of a computer, where should the user insert the card?
uysha [10]

into a port on the outside of the computer


6 0
3 years ago
Read 2 more answers
Implement the function first chars() that takes a list of strings as a parameter and prints to the screen the first character of
Fiesta28 [93]
Def firstChars( word ):
   if( word ): # make sure word has characters
       print( word[ 0 ] ) # print the first character (Python 3 syntax)
3 0
3 years ago
Access time is:________.
worty [1.4K]

Answer:

B) the time it takes for the required sector to position itself under the read/write head.

Explanation:

In Computer science, Access time is the time it takes for the required sector to position itself under the read/write head. It is usually measured in milliseconds.

It is the speed of the storage device.

5 0
3 years ago
Other questions:
  • If you are driving at night, you should not use high-beam headlights within _________ of oncoming vehicles. Florida Road Rules 4
    9·2 answers
  • A typical self-expelling fire extinguisher empties its contents in
    8·1 answer
  • Write a program that uses for loops to perform the following steps: Prompt the user to input two integers: firstNum and secondNu
    15·1 answer
  • Is it important for a writer to include voice and point of view in writing because...<br> Plz help
    10·1 answer
  • 2 ways to make your computer work faster ( please help asap )
    6·1 answer
  • How scientist and technology beliefs society
    14·1 answer
  • When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustm
    13·1 answer
  • What is the bandwidth for asymmetric digital subscriber line<br> (ADSL)?
    10·2 answers
  • How does Virtual Reality help to make work experiences more inclusive?
    13·1 answer
  • Which website offers guidance on putting together a checklist to provide guidance on configuring and hardening operating systems
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!