Question: Program #5 Indirect Sorting Through Pointers - PersonApp Consider a company that needs to sort an array Person data[10] of structures of type Person by
Program #5
Indirect Sorting Through Pointers - PersonApp
Consider a company that needs to sort an array Person data[10] of structures of type Person by name.
struct Person
{
string name;
int age;
}
In real life the Person structures may have many members and occupy a large area of memory, making it computationally expensive to move Personobjects around while sorting. You can define an auxiliary array Person *pData[10], setting each entry of pData[k] to point to the corresponding entry of data[k].
Write a program that sorts the array of pointers so that when you go through pData in increasing order of index k, the entries pData[k] point to Personobjects in ascending alphabetic order of names.
The program must meet the following design requirements:
Test data should be read using file provided peopledata.txt. just need to know what it would look like very confused i have the .text file how do i readin again
An option to enter data manually should be given in case file is not provided.
Use separate files for class or structure specification (declaration such as header files, i.e. Person.h), Implementation (member function definitions, i.e. Person.cpp), and Client code or program (includes main function, i.e. PersonApp.cpp). im really lost on how to sepeat this by section do i combine it all togthert or do i place each in its own solution
Please HELP me understand this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
