/** Copyright and version statement of the program: * Copyright (c) 2013, student * All rights reserved from computer College of Yantai University. * file name: * Author: Zhang Kai * Completion Date: July 15, March 9, 2013 * version: v1.0 * description of the task and solution section: * input Description: none * Problem description: calculate student data * program output: Student Achievement * Problem Analysis: * Algorithm Design: */# include
# Include
# Include
Using namespace std; struct Student {char num [13]; char name [10]; int cpp; int math; int english; int grade; double average ;}; void calculate (Student s [], int n); // calculate the total score and average score. Data in the s array has n elements void sort1 (Student [], int ); // sort void sort2 (Student [], int) in descending order of the total score; // sort void output (Student [], int) in ascending order of Student IDs ); // output transcript void outputExcellent (Student [], int); // output excellent: total score over 285, single subject no less than 90int main () {Student stu [] = {"201152501104", "Tom", 201152501114, 68}, {"", "Jeery", 94, 89, 63 }, {"201152501138", "Speike", 67, 62, 84 },{ "201152501204", "Tyke", 100, 95, 91 },{ "201152501202 ", "Tuffy", 59, 80, 55 },{ "201152501115", "Butch", 100, 99, 89 },{ "201152501201", "Lightning", 95, 92, 99 },{ "201152501145", "Topsy", 88, 56, 67 },{ "201152501203", "Droopy", 62, 62, 95 },{ "201152501140 ", "Drupa", 80, 60, 86 },{ "201152501205", "Buzz", 73, 90, 94 }}; int stuNum = sizeof (stu) /sizeof (stu [0]); // use the sizeof operation to determine the number of elements in the array // calculate the total score and the average score and output calculate (stu, stuNum ); cout <"The following is the transcript:" <
S [k + 1]. grade) {t = s [k]; s [k] = s [k + 1]; s [k + 1] = t ;}} void sort2 (Student s [], int n) // sort by Student ID in ascending order {int I, j; Student t; for (I = 0; I
285 & s [I]. cpp> = 90 & s [I]. math> = 90 & s [I]. english> = 90) {cout <
Running result