Question: Programming in C (Windows, Not C++) #define _CRT_SECURE_NO_WARNINGS #include int daysPerMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31

Programming in C (Windows, Not C++)

#define _CRT_SECURE_NO_WARNINGS

#include

int daysPerMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

typedef struct date

{

int month;

int day;

int year;

} Date;

int numberOfDays(Date d);

bool isLeapYear(int year);

int main(void)

{

Date today, tomorrow;

printf("Enter today's date(mm dd yyyy): ");

scanf("%d%d%d", &today.month, &today.day, &today.year);

if (today.day != numberOfDays(today))

{

tomorrow.month = today.month;

tomorrow.day = today.day + 1;

tomorrow.year = today.year;

}

else if (today.month == 12)

{

tomorrow.month = 1;

tomorrow.day = 1;

tomorrow.year = today.year + 1;

}

else

{

tomorrow.month = today.month + 1;

tomorrow.day = 1;

tomorrow.year = today.year;

}

printf("Today's date is %d/%d/%.2d. ", today.month, today.day, today.year % 100);

printf("Tomorrow's date is %d/%d/%.2d. ", tomorrow.month, tomorrow.day, tomorrow.year % 100);

return 0;

}

int numberOfDays(Date d)

{

// Add your code here

return 30;

}

bool isLeapYear(int year)

{

// Add your code here

return false;

}

Above is a program that asks the user to enter todays date and compute tomorrows date. If you look at the programs output, you may notice that there seems to be a mistake somewhere: The day after February 28, 2012 is listed as March 1, 2012 and not as February 29, 2012. The program forgot about leap years! In this problem, write a function bool isLeapYear(int year) to determine whether a year is a leap year. Also, develop a function called int numberOfDays(Date d) to determine the number of days in a month. The function would perform the leap year test.

Hint: To determine whether a year is a leap year, follow these steps: 1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. 2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. 3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. 4. The year is a leap year (it has 366 days). 5. The year is not a leap year (it has 365 days).

Programming in C (Windows, Not C++) #define _CRT_SECURE_NO_WARNINGS #include int daysPerMonth[12] =

{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30,

C:lUsers Izouja \Desktop DateOfTomorrow Debug Dateotf Enter today' s date(mm dd yyyy>: 10 24 2017 Today s date is 10/24/1? Tomorrow' s date is 10/25/17. C:Users\zouja\Desktop \DateOfTomorrow\Debug Date Enter today's date(mm dd yyyy>: 9 30 201? Today's date is 9/30/17. Tomorrow' s date is 10/1/17

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 Databases Questions!