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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started