92) Fix the Error
typedef struct
{
int day;
int month;
int year;
} date_t;
typedef struct
{
char surname[20];
char forename[20];
date_t birthday;
} person_t;
int main() {
person_t person[MAX_ENTRIES];
inentry;
for (entry = 0; entry < MAX_ENTRIES; entry++)
{
printf("\n\nRecord %d:\n", entry);
printf("Enter the surname: ");
scanf("%s", person[entry].surname);
scanf("%s", person[entry].forename);
scanf("%d", &person[entry].birthday.day);
scanf("%d", &person[entry].birthday.month);
scanf("%d", &person[entry].birthday.year);
printf("Enter an index between 0 and %d: ", MAX_ENTRIES - 1);
scanf("%d", &entry);
printf("Surname: %s\n", person[entry].surname);
printf("Forename: %s\n", person[entry].forename);
printf("Date of birth: %02d/%02d/%04d\n\n\n",
#include<stdio.h>
const int MAX_ENTRIES = 50;
typedef struct
{
int day;
int month;
int year;
} date_t;
typedef struct
{
char surname[20];
char forename[20];
date_t birthday;
} person_t;
int main() {
person_t  person[MAX_ENTRIES];
int entry;
for (entry = 0; entry < MAX_ENTRIES; entry++)
{
printf("\n\nRecord %d:\n", entry);
printf("Enter the surname: ");
scanf("%s", person[entry].surname);
scanf("%s", person[entry].forename);
scanf("%d", &person[entry].birthday.day);
scanf("%d", &person[entry].birthday.month);
scanf("%d", &person[entry].birthday.year);
printf("Enter an index between 0 and %d: ", MAX_ENTRIES - 1);
scanf("%d", &entry);Â Â Â Â Â Â Â Â Â
printf("Surname: %s\n", person[entry].surname);
printf("Forename: %s\n", person[entry].forename);
printf("Date of birth: %02d/%02d/%04d\n\n\n",person[entry].birthday.day,person[entry].birthday.month,person[entry].birthday.year);
}}
Comments
Leave a comment