Advertisement
LEGEND2004

Vac

Apr 10th, 2023
810
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. struct date {
  4.     int year;
  5.     int month;
  6.     int day;
  7. };
  8.  
  9. struct time {
  10.     int hour;
  11.     int minute;
  12.     int second;
  13. };
  14.  
  15. struct vaccine_person {
  16.     int person_id;
  17.     char name[50];
  18.     int age;
  19.     struct date vaccination_date;
  20.     struct time vaccination_time;
  21. };
  22.  
  23. int main() {
  24.     struct vaccine_person person1 = {
  25.         123456,
  26.         "John Smith",
  27.         30,
  28.         {2021, 4, 10},
  29.         {14, 30, 0}
  30.     };
  31.  
  32.     printf("Person ID: %d\n", person1.person_id);
  33.     printf("Name: %s\n", person1.name);
  34.     printf("Age: %d\n", person1.age);
  35.     printf("Vaccination Date: %d-%02d-%02d\n",
  36.            person1.vaccination_date.year,
  37.            person1.vaccination_date.month,
  38.            person1.vaccination_date.day);
  39.     printf("Vaccination Time: %02d:%02d:%02d\n",
  40.            person1.vaccination_time.hour,
  41.            person1.vaccination_time.minute,
  42.            person1.vaccination_time.second);
  43.  
  44.     return 0;
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement