[Cpp]/** Copyright and version statement of the program section * Copyright (c) 2013, student * All rightsreserved from computer College of Yantai University. * file name: score. cpp * OPERATOR: Ji Zilong * Completion Date: July 15, March 8, 2013 * version: v1.0 * input Description: none * Problem description: none * output: none */# include <iostream> # include <fstream> // The operation file must contain using namespace std; struct Score {char num [14]; char nam [30]; int cpp; int math; int english; int sumg; struct Score * next;}; void sort1 (Score p [], int n); void output (Score p [], int n); Int main () {Score * head = NULL, * p, * q; int I = 0, j, m; long asg [200]; Score score [200]; // in the input format (ios: inner opens the file, and javasscore.txt must contain ifstream infile ("score.txt", ios: in) in the folder; // test whether the file is opened successfully, when opening fails (if the data file to be read does not exist), exit if (! Infile) {cerr <"open error! "<Endl; exit (1) ;}while (! Infile. eof () {p = new Score; infile> p-> num> p-> nam> p-> cpp> p-> math> p-> english; p-> sumg = p-> cpp + p-> math + p-> english; p-> next = NULL; if (I = 0) head = p; else q-> next = p; q = p; I ++;} infile. close (); p = head; asg [0] = head-> sumg; for (j = 1; j <I; j ++) asg [j] = asg [J-1] + score [j]. sumg; m = asg [j]/j; cout <"the total score is higher than the average total score and the score transcript is:" <endl; while (p! = NULL) {if (p-> cpp)> 59 & (p-> math)> 59 & (p-> english)> 59 & (p-> sumg)> m) {cout <p-> nam <"" <p-> cpp <"<p-> math <" <p-> english <"" <p-> sumg <endl; p = p-> next;} else p = p-> next;} return 0;} running result: