Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Create a structure of type date that contains three members: the month, the day of the month, and the year

0 votes
asked May 23, 2019 by mark (450 points)
Create a structure of type date that contains three members: the month, the day of the month, and the year, all of type int. (Or use day-month-year order if you prefer.) Have the user enter a date in the format 12/31/2001, store it in a variable of type struct date, then retrieve the values from the variable and print them out in the same format. 0.2 Points

1 Answer

0 votes
answered May 24, 2019 by Gokulram Rajendran
#include <stdio.h>

struct date
{
  int month;
  int day_of_month;
  int year;
};

int main ()
{
 
  struct date d1;
 
  printf ("Enter month (in format ex:12/31/2001) : ");
  scanf ("%d/%d/%d", &d1.month,&d1.day_of_month,&d1.year);
  printf("The Entered Date is : %d/%d/%d",d1.month,d1.day_of_month,d1.year);
 
  return 0;
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...