Writeaprogramthatwillperformthesameoperationstwiceonceusing


Computer Science

Program- Write a program that will perform the same operations twice, once using an array of structs, and once using a pair of parallel arrays. The data will represent people's names and ages, so the first data structure will be an array of structs, each of which contains a string and an int, while the second will be separate arrays of strings and ints.

For both data structures, use functions to do the following tasks:

Open a user specified file for input. The file will contain a series of people's names and ages.

Get the data from the file and store it into the array space(s)

Search the array(s) for the position of the person with the greatest age, bring back the integer position value.

Output the name and age of the person with the highest age, along with a brief text message.

A main program might take the form of:

openFile
getParallelData
loc = searchParallel
outputParallel
openFile
getStructData
loc = searchStruct
outputStruct

The array sizes should all be 10, but your code should handle files that contain data for less than 10 people and files that contain data for more than 10 people.

The input files will take the form:

John J. Johnson
23
Sally Smith
19
. . .

The output should be something like this (showing the output from both parts):

John J. Johnson is the oldest at 23
John J. Johnson is the oldest at 23

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Writeaprogramthatwillperformthesameoperationstwiceonceusing
Reference No:- TGS01661280

Now Priced at $45 (50% Discount)

Recommended (98%)

Rated (4.3/5)