Question: Define a Student structure that contains an integer variable id , a string variable name, and a float variable GPA. Write a program to read

Define a Student structure that contains an integer variable id, a string variable name, and a float variable GPA.
Write a program to read students' information from an input text file entered by the user. The program then print to the standard output
students' names who have a GPA>3.0 in order. For simplicity, you can safely assume that the number of students
in the file is always less than or equal to 10.
Ex: if the input file contains:
id=1234567 name=Peter GPA=3.6
id=1234568 name=Adina GPA=3.8
id=1234569 name=Mike GPA=3.0
id=1234569 name=Gina GPA=2.9
then the program will output
Peter
Adina
Note: the content in the input file may be empty.
You Must define and call the following function to read and parse the students' information from a text file. This function takes an ifstream
object (assuming the file is opened successfully), the Student array and an integer counting the number of students in the file as input.
void ReadStudentInfo(ifstream sifs, Student array[], int cnStudents);
Hint: use the getline () function to load the individual students' information one line at a time. To parse the information in this line, you
may use a stringstream object. Assume the student's information is stored in a string studentInfo, you then can create a
stringstream object as stringstream myStream (studentInfo). You then can use myStream>> to get the information like how
you used cins to get multiple input from the user. To suocessfully retrieve the individual information, you may need to first replace each
'=' with a whitespace ' before creating the stringstream object.
In the main () function,
first, create a Student array with 10 elements
second, read information into the created array, count the number of students in the file
third, print students names in the reversed order to the screen
 Define a Student structure that contains an integer variable id, a

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!