Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that asks the user to enter the name and the hometown of 3 persons. Name and hometown are stored in a

 

Write a program that asks the user to enter the name and the hometown of 3 persons. Name and hometown are stored in a structure Person. The 3 persons are stored in an array. Afterwards, the program asks the user to enter a name and searches the town that person lives in. Use the functions readPerson and search Town. The function search Town has 2 arguments: - the array that needs to be searched - a variable of the type Person that contains the name that needs to be searched. The town member of that variable needs to be filled with the town found by the function search Town. Reading the name of the person you want to search for is done in the main function. Printing the resulting town can also be done in the main function. If the name entered is not present in the array, an appropriate message needs to be printed. (Written in C language) Sample run: Enter name: Smith Enter town or city: Berkeley Enter name: Minogue Enter town or city : London Enter name: O'Neil Enter town or city: Dover Enter the name of the person you want to search for: Smith This person lives in Berkeley

Step by Step Solution

3.38 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

AnswerHere is the C program include include typedef stru... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Computer Engineering questions