Question
this is the code in C++ i want to let the user be able to enter new date and whenever he enters month more than
this is the code in C++ i want to let the user be able to enter new date and whenever he enters month more than 12 like 13 or zero or negative it will default to 1 and display the new date result
#include
int main() { int day, month, year; // Create a Date object with the constructor and initialize the data members Date today(2, 3, 2023); // Display the date cout << "Today's date is: "; today.displayDate(); }
all you need to do is add few extra steps where the main function is, to let the user enter new day and month and year , and whenever the month entered is not between 12 and 1 it will default the month to 1
the whole purpose behind this is to test the class capabilities focusing on entering wrong month and defaulting it to 1 unless you enter the correct month then it is void
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