fork download
  1. #include <stdio.h>
  2. #include <string.h> // needed for strcpy()
  3.  
  4. // supporting structure for dates
  5. struct date {
  6. int day;
  7. int month;
  8. int year;
  9. };
  10.  
  11. // Owner Information: Name, Address, Telephone Number
  12. struct ownerInfo {
  13. char name[60];
  14. char address[100];
  15. char phone[20];
  16. };
  17.  
  18. // Animal Information: Name, Species, Sex, Age, Weight, Microchip Number
  19. struct animalInfo {
  20. char name[60];
  21. char species[30];
  22. char sex[10];
  23. int age;
  24. float weight;
  25. char microchip[25];
  26. };
  27.  
  28. // Rabies Information: Producer, lot number, date vaccinated, and validity (years)
  29. struct rabiesInfo {
  30. char producer[4]; // first 3 letters + '\0'
  31. char lotNumber[20]; // alphanumeric
  32. struct date dateVaccinated;
  33. int validityYears;
  34. };
  35.  
  36. // Veterinarian Information: Name, License Number, and date signed
  37. struct vetInfo {
  38. char name[60];
  39. char license[20];
  40. struct date dateSigned;
  41. };
  42.  
  43. // Main DD2209 record combining all information
  44. struct dd2209 {
  45. struct ownerInfo owner; // stores owner's name, address, and phone number
  46. struct animalInfo animal; // stores animal's details (name, species, sex, age, etc.)
  47. struct rabiesInfo rabies; // stores rabies vaccination details
  48. struct vetInfo vet; // stores veterinarian's name, license, and signature date
  49. };
  50.  
  51. int main(void)
  52. {
  53. struct dd2209 form; // create one instance of the main structure
  54.  
  55. // Fill owner information
  56. strcpy(form.owner.name, "Jane Doe");
  57. strcpy(form.owner.address, "123 Main Street, Columbia, SC");
  58. strcpy(form.owner.phone, "803-555-1234");
  59.  
  60. // Fill animal information
  61. strcpy(form.animal.name, "Nala");
  62. strcpy(form.animal.species, "Canine");
  63. strcpy(form.animal.sex, "Female");
  64. form.animal.age = 5;
  65. form.animal.weight = 18.5;
  66. strcpy(form.animal.microchip, "985112003456789");
  67.  
  68. // Fill rabies information
  69. strcpy(form.rabies.producer, "PFZ"); // first three letters of producer
  70. strcpy(form.rabies.lotNumber, "AB12X9");
  71. form.rabies.dateVaccinated.day = 12;
  72. form.rabies.dateVaccinated.month = 4;
  73. form.rabies.dateVaccinated.year = 2024;
  74. form.rabies.validityYears = 3;
  75.  
  76. // Fill veterinarian information
  77. strcpy(form.vet.name, "Dr. Emily Carter");
  78. strcpy(form.vet.license, "SCVET23456");
  79. form.vet.dateSigned.day = 15;
  80. form.vet.dateSigned.month = 4;
  81. form.vet.dateSigned.year = 2024;
  82.  
  83. // Print all information
  84. printf("----- Veterinary Health Certificate (DD Form 2209) -----\n\n");
  85.  
  86. printf("Owner Information:\n");
  87. printf(" Name: %s\n", form.owner.name);
  88. printf(" Address: %s\n", form.owner.address);
  89. printf(" Telephone: %s\n\n", form.owner.phone);
  90.  
  91. printf("Animal Information:\n");
  92. printf(" Name: %s\n", form.animal.name);
  93. printf(" Species: %s\n", form.animal.species);
  94. printf(" Sex: %s\n", form.animal.sex);
  95. printf(" Age: %d years\n", form.animal.age);
  96. printf(" Weight: %.1f kg\n", form.animal.weight);
  97. printf(" Microchip #: %s\n\n", form.animal.microchip);
  98.  
  99. printf("Rabies Vaccination Information:\n");
  100. printf(" Producer: %s\n", form.rabies.producer);
  101. printf(" Lot Number: %s\n", form.rabies.lotNumber);
  102. printf(" Date Vaccinated: %02d/%02d/%d\n", form.rabies.dateVaccinated.day,
  103. form.rabies.dateVaccinated.month, form.rabies.dateVaccinated.year);
  104. printf(" Valid for: %d years\n\n", form.rabies.validityYears);
  105.  
  106. printf("Veterinarian Information:\n");
  107. printf(" Name: %s\n", form.vet.name);
  108. printf(" License #: %s\n", form.vet.license);
  109. printf(" Date Signed: %02d/%02d/%d\n", form.vet.dateSigned.day,
  110. form.vet.dateSigned.month, form.vet.dateSigned.year);
  111.  
  112. return 0;
  113. }
  114.  
  115.  
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
----- Veterinary Health Certificate (DD Form 2209) -----

Owner Information:
  Name: Jane Doe
  Address: 123 Main Street, Columbia, SC
  Telephone: 803-555-1234

Animal Information:
  Name: Nala
  Species: Canine
  Sex: Female
  Age: 5 years
  Weight: 18.5 kg
  Microchip #: 985112003456789

Rabies Vaccination Information:
  Producer: PFZ
  Lot Number: AB12X9
  Date Vaccinated: 12/04/2024
  Valid for: 3 years

Veterinarian Information:
  Name: Dr. Emily Carter
  License #: SCVET23456
  Date Signed: 15/04/2024