Question: Create a c++ program in which you are to read a text file containing student information and their grade for the current semester and check
Create a c++ program in which you are to read a text file containing student information and their grade for the current semester and check whether they are failing all courses (3 total). You are to declare 3 structures called Name, Grades, and StudentInfo respectively. The structure Name contains two char arrays containing a students first and last name. The structure Grades contains 3 chars that hold the grades for three classes the student is taking: math, science, and English. The last structure StudentInfo contains 3 datatypes: an int for student ID, a Name, and Grades. The structure StudentInfo will hold all the information needed for the student. In main, youre to create an array of the structure StudentInfo that can hold as many students as there are in the file StudentInfo.txt. Youll open the file in main (be sure to check if it is opened!) and call the function ReadFile to read the contents of the file and store them appropriately in the structure array before returning to main. Once the student info is read and stored, main will call the function IsFailing and check which students are failing all the classes. Mains job is to simply open the file, call the ReadFile and IsFailing functions.
ReadFile will take as argument the file to read, the StudentInfo structure array, and the number of students. It will store all the information from the text file into the structure. Note: this function returns nothing.
IsFailing will take as argument the StudentInfo structure array and the number of students. It will check each student who is failing all three courses. If a student is failing all three courses, it will call DispName to display the name of the student who is failing. If there are no students who are failing, then a message will be printed to the output screen that no students are currently failing. Note: this function returns nothing.
DispName will take as argument a StudentInfo structure and display the first and last name to the output screen. Note: this function returns nothing. Please heavily comment the program so I know what each line of code does. Use fstream and iostream
Sample runs:


The contents of the File include student info:

The following student(s) are failing: Sina Schram Wesley Fontanez Syreeta Silverstein
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
