Question: Write a complete C++ program called Lab 4 A .cpp that prompts the user to enter a character to represent the season: ' S '

Write a complete C++ program called

Lab

4

A

.cpp

that

prompts the user to enter a

character

to represent

the season: '

S

' for

Summer

, 'F' for fall, 'W' for winter and '

G

' for

spring.

Declare an

enumeration co

nstant with the following set of values

:

Summer,

Fall,

Winter

and Spring and assign letters '

S

', 'F', 'W' and '

G

' to

them,

respectively.

You will use

these seasons as case constants in your switch

-

case block.

Ask the user for their choice of season using

a suitable message.

Then, u

sing

a

switch

-

case

block,

display the following:

If the user enters

s

or

S

, display

:

It

is

rather

hot outside

.

If the user enters

f or

F

, display

:

The weather looks good

.

If the user enters

w or W

, display

:

It

is rather

cold outside

.

If the user enters,

g

or

G

display

:

The flowers are blooming

.

If the user enters anything else, display

:

Wrong choice.

You must

write this program

using a

switch

-

case

block

.

2

Use the toupper() fuction to convert the character to uppercase, so

that your program

works for both lowercase and uppercase inputs.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!