Question: Using C+ Create a dynamic array based student record program. Ask the user how many students to input. Give the user a chance to fill

Using C+

Create a dynamic array based student record program. Ask the user how many students to input. Give the user a chance to fill the array with random data (you will create a random data function to do this) or enter the data randomly.

When creating the array, create it dynamically as an array of structs, using the Person struct described below:

struct Person {

string firstName;

string lastName;

int age;

int id;

}

Allow the user to sort the array in ascending or descending order based on last name, age or ID#.

Handle the case where 2 or more students have the same last name.

When creating your random data function use an array of 25 first names and 25 last names that you define from the start and randomly pick a name form each array to populate the student record. Age and ID# can be generated as random integers.

Make all ID# 9 digits long and prevent any 2 students from having the same ID#.

When outputting the sorted lists, format the results nicely with a header row at the top as well as the addresses for each variable in (paranthese) after the value. Also output a line number for each student in the list.

for example:

Student List sorted Alphabetically Ascending by Last Name

# Fisrt Name Last Name Age ID#

1) Michael(03450A8) Hudson(03450F3) 47(0345128) 123456789(034512D)

This is what I have so far and i am stuck

#include #include

using namespace std;

int numStudents;

struct Person{ string firstName; string lastName; int age; int id; };

int main() {

cout << " " "How many Students would you like to input?" << endl; cin >> numStudents;

Person *students = new Person[numStudents];

cout << " " "Would you like to Manually input the Students, or have Students choose Randomly for you? (Manual/Random)" << endl; cin >> sortType;

if sortType

system("pause"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!