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
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