/* Reading data from the 2-to-2 project to the student score.txt (paste the self-built data from this article) is the student ID, name, C ++, high number, and English score of some students. It defines an array of student scores, the members include student ID (char num [12]), name (name), score (grade), and total score (score )). (1) read data from the file and store it in your defined struct array; (2) output records of all students in the struct array. */# Include <iostream> # include <cstdlib> # include <fstream> using namespace std; struct student {char num [20]; char name [10]; int cpp; int math; int english; int grade ;}; const int n = 200; int main () {int I, stunum = 0; student stu [n]; ifstream infile ("score.txt", ios: in); if (! Infile) {cerr <"open error" <endl; exit (1) ;} I = 0; while (! Infile. eof () {infile> stu [I]. num> stu [I]. name> stu [I]. cpp> stu [I]. math> stu [I]. english; stu [I]. grade = stu [I]. cpp + stu [I]. english + stu [I]. math; stunum ++; I ++;} infile. close (); for (I = 0; I <stunum; I ++) {cout <stu [I]. num <"\ t" <stu [I]. name <"\ t" <stu [I]. cpp <"\ t" <stu [I]. math <"\ t" <stu [I]. english <"\ t" <stu [I]. grade <endl;} return 0 ;}