Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

\f

Answered: 1 week ago