You must ensure that the user enters valid dates. This means a valid year, a val
ID: 3621361 • Letter: Y
Question
You must ensure that the user enters valid dates. This means a valid year, a valid month, and a valid day of the month. Your program should then start at the beginning date (which must not be after the ending date), and count each day until the ending date. The program should print out the Month and Year as it counts (NB: not the day).If you count a February that is in a leap year, note that in the output.The final output will be two items: the number of days and the number of leap years between the dates.
Explanation / Answer
// Days in-between dates // Compiled in Visual C++ 2008 Express Edition // Language: C++/STL #include using namespace std; int main() { int days_in_months[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int first_day, second_day; int first_month, second_month; int first_year, second_year; int years_difference, days_difference; int months_total; int reg_year = 365; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.