Sale!

Program 3 – Structs and Pointers

$30.00

Category:
Rate this product

C++ for Java Programmers
Program 3 – Structs and Pointers

Create a Student structure with the following fields:
Student ID (int – unique 6 digit number)
Name (cstring or null-terminated character array)
grade (char – Values A thru F)
birthday (myDate – random value: range 1/1/1999 to 12/31/2004)
Home Town (string)

Create an array of 9 Student pointers.
Write a function that passes the Student Pointer array into the function and then creates 9 students and assigns each student to one of the Student Pointer array elements.

Back in the main program, create a second array of 9 Student pointers and copy the pointers from the first array.

Next, create 5 functions that will sort the copy in ascending order. The first will sort by Student ID, second by name, third by Grade, forth by Birthday and the last function will sort by HomeTown.

Write a display function that displays the contents of an array of Student pointers on the screen as shown below – nicely formatted and each field must be left justified.

The displayed list should be nicely formatted with column names like this: All columns should be left-justified.

Student ID Name Grade Birthday Home Town
100342 Tom Thumb C January 1, 1999 Small Ville
195495 Fred Flintstone D February 3, 2002 Bedrock
792987 Sponge Bob B June 3, 2001 Bikini Bottom

Create a menu that shows the following options:

1) Display original list (in the order it was created)
2) Display list sorted by Student ID
3) Display list sorted by Name
4) Display list sorted by Grade
5) Display list sorted by Birthday
6) Display list sorted by Home Town
7) Exit

Note:
Take advantage of your myDate class that you just wrote. Also, it might be helpful to create a new function that returns a string for the date format:

string myDate::formatDate( );

To help with formatting you may want to use the library <iomanip which includes the setw() function.
Additional requirement – Please print the entire program listing to hand in during the demo.

Open chat
Need help?
Hello
Can we help you?