1. (50%) Program Q1.c Write a C program (a) Create a date structure date that has 3 members year, month and day, and the
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
1. (50%) Program Q1.c Write a C program (a) Create a date structure date that has 3 members year, month and day, and the
1. (50%) Program Q1.c Write a C program (a) Create a date structure date that has 3 members year, month and day, and the types are all integers. (b) Declare a structure variable holiday of the structure date type, and set its initial value to {2004, 4, 26}. (c) Declare a structure variable festival of the structure date type. Read data for setting festival. (d) Print out the values of structure holiday and festival in format mm/dd/yyyy. For example, 06/18/2004. (e) Declare a pointer ptr that points to structure variable holiday. Read data for setting holiday by using pointer ptr. (d) Print out the values that pointer ptr points to in format mm/dd/yyyy. The screen dialog should appear as follows: Enter data for festival: year: 2005 month: 12 day: 25 festival 12/25/2005 holiday 04/26/2004 Enter data for pointer points to: year: 2008 month: 10 day: 21 *ptr=10/21/2008