Question: Write a program named days of month.cpp that prompts to users to enter the year and first three letters of a month ( these letters

Write a program named
days
of
month.cpp
that prompts to users to enter the
year
and first
three letters of a
month
(these letters can be either uppercase or lowercase). Displays the
number of days of the
month
.
Your program must displays message
"Invalid month. Please use three first letters
of the month name!"
if the user entered incorrect months name.
Hints:
Use function
std::toupper()
or
std::tolower()
to standardize the months name
before checking its meaning. These two functions are declared in
string
library.
The February of a leap year (divisible by 4) has 29 days instead of 28 days.
Here are some example outputs when running the program from a terminal.
/workspace/csc117/hw5
$
g++-o out/days_of_month.out src/days_of_month.cpp
$
./out/days_of_month.out
Enter a year: 2024
Enter a month: Feb
Feb 2024 has 29 days
$
./out/days_of_month.out
Enter a year: 2014
Enter a month: Feb
Feb 2014 has 28 days
$
./out/days_of_month.out
2
Enter a year: 2024
Enter a month: 10
Invalid month. Please use three first letters o

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!