Question: LAB 1 5 . 9 . 1 : LAB: Student database 0 1 0 Write a program that uses a struct named Student to store

LAB
15.9.1: LAB: Student database
010
Write a program that uses a struct named Student to store information about a Student. You will be reading from a text input file into an array (size 20) of Student structs. The program will contain the following files:
main.cpp contains the main function for testing the program.
Student.h and Student.cpp represent a classroom student struct, which has three data members:
first name, last name, and GPA.
students, txt - Text file with student information
(1) Build the Student struct with the following specifications in the files (Student.h and Student.cpp):
char firstName[101]
char lastName [101]
double gpa;
You may NOT use strings.
(2) Create the following functions (Student.h and Student.cpp):
void loadValues(ifstream &inFile, Student studentList[, int &numStudents); // reads from file, populates the array, updates the number of students in the array
void printValues(Student studentList], int numStudents); // prints the contents of the array
(3) In main ()(main.cpp), open the students.txt file and pass to the loadvalues () function to read the student data into the array. Then call the printValues () function to print out the list of students.
(4) Program input and output:
File input, students . txt:
Henry; Nguyen; 3.5
Brenda; Stern; 2.0
Lynda; Robison; 3.2
Sonya;King; 3.9
Program output:
\table[[Henry,Nguyen,3.5],[Brenda,Stern,2.0],[Lynda,Robison,3.2]]
(5) Notes:
Add the struct definition before the function prototypes! Check out Structs and Array Example, Section 14.4
Make sure to have #include main()=0;
 LAB 15.9.1: LAB: Student database 010 Write a program that uses

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!