Question: /* Instruction: 1. run this c program and copy/past the output at the end of the source code 2. modify the program so that the

/* Instruction: 1. run this c program and copy/past the output at the end of the source code

2. modify the program so that the setDate() function will generate a randome month, day and year instead of using 6/3/2005 Note: be sure you handle the leap year case for february case.

*/

#include

/* declaration of the data structure */

struct Date

{

int month;

int day;

int year;

};

/* implementation of associated functions */

/* operation to assign values to a Date object */

struct Date setdate(int mm, int dd, int yyyy)

{

struct Date temp;

temp.month = mm;

temp.day = dd;

temp.year = yyyy;

return(temp);

}

/* operation to display a Date object */

void showdate (struct Date a)

{

printf("%02d/%02d/%02d", a.month, a.day, a.year % 100);

}

int main()

{

struct Date a;

a = setdate(6,3,2005);

printf(" The value of the a object is: ");

showdate(a);

printf(" ");

return 0;

}

Help solve please

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!