hello! i can't get the right output, it says "EOFERROR: EOF when reading a line"
Instructions:
here's my code:
#includetypedef struct { int age; char gender;} Person;void displayPerson(Person);int main(void) { Person persons[5]; for(int i=0;i<> { printf("Person #%d\n",i+1); printf("Enter Person's age: "); scanf("%d\n",&persons[i].age); printf("\nEnter Person's gender: \n"); scanf("%c\n",&persons[i].gender); } for(int i=0;i<> displayPerson(persons[i]); return 0;}void displayPerson(Person p) { printf("PERSON DETAILS:\n"); printf("Age: %d\n", p.age); printf("Gender: "); if(p.gender == 'M') { printf("Male"); } else { printf("Female"); } printf("\n\n");}Extracted text: Input 1. A series of ages and genders of the 5 Persons Cutput Person #1 Enter Person's age: 24 Enter Person's gender: M Person #2 Enter Person's age: 21 Enter Person's gender: F Person a Enter Person's age: 22 Enter Person's gender: F Person 4 Enter Person's age: he Enter Person's gender: F Person 5 Enter Person's age: 54 Enter Person's gender: M PERSON DETAILS: Age: 24 Gender: Male PERSON DETALS: Age 21 Gender: Fenale PERSON DETALLS: Age: 22 Gender: Fenale PERSON DETALS: Age: 60 Gender: Fenale PERSON DETALSI Age: 64 Gender: Male
return 0;}
void displayPerson(Person p) { printf("PERSON DETAILS:\n"); printf("Age: %d\n", p.age); printf("Gender: "); if(p.gender == 'M') { printf("Male"); } else { printf("Female"); } printf("\n\n");}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here