(C PROGRAMMING ONLY)   3. From Person to People by CodeChum Admin Now that we have created a Person, it's time to create more Person and this tech universe shall be filled with people!     Instructions: In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. In the main() function, there's a pre-created array of 5 Persons. Your task is to ask the user for the values of the age and gender of these Persons. Then, once you've set their ages and genders, call the displayPerson() function and pass them one by one. Input 1. A series of ages and genders of the 5 Persons     Output 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 #3 Enter Person's age: 22 Enter Person's gender: F Person #4 Enter Person's age: 60 Enter Person's gender: F Person #5 Enter Person's age: 64 Enter Person's gender: M PERSON DETAILS: Age: 24 Gender: Male PERSON DETAILS: Age: 21 Gender: Female PERSON DETAILS: Age: 22 Gender: Female PERSON DETAILS: Age: 60 Gender: Female PERSON DETAILS: Age: 64 Gender: Male

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

(C PROGRAMMING ONLY)

 

3. From Person to People
by CodeChum Admin

Now that we have created a Person, it's time to create more Person and this tech universe shall be filled with people!

 

 

Instructions:

In the code editor, you are provided with the definition of a struct Person. This struct needs an integer value for its age and character value for its gender. Furthermore, you are provided with a displayPerson() function which accepts a struct Person as its parameter. In the main() function, there's a pre-created array of 5 Persons.
Your task is to ask the user for the values of the age and gender of these Persons.
Then, once you've set their ages and genders, call the displayPerson() function and pass them one by one.
Input

1. A series of ages and genders of the 5 Persons

 

 

Output

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 #3
Enter Person's age: 22
Enter Person's gender: F

Person #4
Enter Person's age: 60
Enter Person's gender: F

Person #5
Enter Person's age: 64
Enter Person's gender: M

PERSON DETAILS:
Age: 24
Gender: Male

PERSON DETAILS:
Age: 21
Gender: Female

PERSON DETAILS:
Age: 22
Gender: Female

PERSON DETAILS:
Age: 60
Gender: Female

PERSON DETAILS:
Age: 64
Gender: Male

main.c
1 #include<stdio.h>
2
3 typedef struct {
4
int age;
5
char gender;
6} Person;
7
8 void display Person (Person);
9
10 int main(void) {
11
Person persons [5];
12
13
14
15
return 0;
16}
17
18 void displayPerson (Person p) {
printf("PERSON DETAILS:\n");
19
20
21
printf("Age: %d\n", p.age);
printf("Gender: ");
if(p.gender == 'M') {
22
23
printf("Male");
<> + C
1
1
Transcribed Image Text:main.c 1 #include<stdio.h> 2 3 typedef struct { 4 int age; 5 char gender; 6} Person; 7 8 void display Person (Person); 9 10 int main(void) { 11 Person persons [5]; 12 13 14 15 return 0; 16} 17 18 void displayPerson (Person p) { printf("PERSON DETAILS:\n"); 19 20 21 printf("Age: %d\n", p.age); printf("Gender: "); if(p.gender == 'M') { 22 23 printf("Male"); <> + C 1 1
}.
if(p.gender == 'M') {
printf("Male");
} else {
printf("Female");
}
printf("\n\n");
Transcribed Image Text:}. if(p.gender == 'M') { printf("Male"); } else { printf("Female"); } printf("\n\n");
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY