Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- struct Date {
- int day;
- int month;
- int year;
- };
- struct Time {
- int hours;
- int minutes;
- };
- struct VaccinationPlace {
- char name[50];
- char address[100];
- int capacity;
- };
- struct Vaccine {
- char name[50];
- char manufacturer[50];
- int dosesRequired;
- };
- struct Person {
- char name[50];
- int age;
- char address[100];
- };
- struct Appointment {
- struct Date date;
- struct Time time;
- struct VaccinationPlace place;
- struct Vaccine vaccine;
- struct Person person;
- };
- struct Supply {
- struct Vaccine vaccine;
- int quantity;
- };
- void printAppointment(struct Appointment appt) {
- printf("Appointment Details:\n");
- printf("Date: %d/%d/%d\n", appt.date.day, appt.date.month, appt.date.year);
- printf("Time: %d:%02d\n", appt.time.hours, appt.time.minutes);
- printf("Vaccination Place: %s (%s)\n", appt.place.name, appt.place.address);
- printf("Vaccine: %s by %s (%d doses required)\n", appt.vaccine.name, appt.vaccine.manufacturer, appt.vaccine.dosesRequired);
- printf("Person: %s (%d years old, %s)\n", appt.person.name, appt.person.age, appt.person.address);
- }
- void printSupply(struct Supply supply) {
- printf("Vaccine Supply:\n");
- printf("Vaccine: %s by %s (%d doses required)\n", supply.vaccine.name, supply.vaccine.manufacturer, supply.vaccine.dosesRequired);
- printf("Quantity: %d\n", supply.quantity);
- }
- int main() {
- // Create example data
- struct Date apptDate = {10, 4, 2023};
- struct Time apptTime = {12, 30};
- struct VaccinationPlace apptPlace = {"Community Center", "123 Main St, Anytown, USA", 50};
- struct Vaccine apptVaccine = {"Moderna", "Moderna, Inc.", 2};
- struct Person apptPerson = {"John Doe", 35, "456 Elm St, Anytown, USA"};
- struct Appointment appt = {apptDate, apptTime, apptPlace, apptVaccine, apptPerson};
- struct Vaccine supplyVaccine1 = {"Pfizer-BioNTech", "Pfizer, Inc.", 2};
- struct Supply vaccineSupply1 = {supplyVaccine1, 100};
- struct Vaccine supplyVaccine2 = {"Johnson & Johnson", "Janssen Pharmaceuticals, Inc.", 1};
- struct Supply vaccineSupply2 = {supplyVaccine2, 50};
- // Print example data
- printAppointment(appt);
- printf("\n");
- printSupply(vaccineSupply1);
- printf("\n");
- printSupply(vaccineSupply2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement