EG H167 DAILY ASSIGNMENT D18 ADVANCED
1) Complete the regular D18 assignment, which illustrates using a C struct to organize a collection of data types.
2) Modify your D18 source code to use a C++ class instead of a struct. That is, you will be replacing your student struct with a class by the same name. The skeleton below will work for your class, but feel free to modify it or create your own entirely. If you choose to create your own class definition, please make sure to include at least one member function and at least one data member.
student(); // Default constructor
void fill(); // Asks user to enter data for this student
void printout(); // Prints out data about this student to the screen
char name; // Stores student name
long int id; // Stores student ID number
float gpa; // Stores student GPA
If you use the suggested skeleton above, you may modify your existing fillaray() function to work in your new class by changing its name to void student::fill(). You will also have to change the variable names within the function to reflect the fact that the name, id, and gpa variables are now members of the class.
2) Implement the default constructor student::student() for your class. The constructor should initialize both numeric values to zero, and set the first character of the name field to the null character ’\0‘.
2) Modify your main() function to use an array of 5 student objects instead of an array of structs. (If you made your own class that stores an array internally, you may use a single object, but make sure your program accepts data for 5 students.) As before, your program should prompt the user to enter data for the 5 students, and then print out the student data to the screen. If you used the suggested skeleton above, this may be accomplished by calling the fill() and printout() functions.