Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

4. Explain the characteristics of successful mentoring programs.

Answered: 1 week ago