Each student's informatics number, name, C + +, high number, English scores. An array of structural bodies that define a student's performance, including the number of data members (char num[13]), the name (name), the score of the course (grade), the total score (score), and the averaging (average)).
(1) Enter the information of n students from the keyboard (n is defined as a constant variable);
(2) To find out the total and average of each student, and stored in the structure of the array (can be read into the process of "by the Way" calculation);
(3) Output each student's informatics number, name, total score and sharing.
/** Copyright (c) 2014, Yantai University School of Computer * All right reserved.* Shao * file: temp.cpp* finish: December 20, 2014 * version number: v1.0*/#include <iostream > #include <iomanip>using namespace std;struct student{ char num[13]; Char name[10]; int cpp; int math; int 中文版; int grade; Double average;}; const int N=3;int Main () { int i, j, K; Define struct-body array Student stu[n]; cout<< "Please enter student's number, name, CPP score, math score and English score in turn" <<endl; for (i=0; i<n; i++) { Cin>>stu[i].num>>stu[i].name>>stu[i].cpp>>stu[i].math >>stu[i].english; Stu[i].grade=stu[i].cpp+stu[i].math+stu[i].english; stu[i].average=stu[i].grade/3.0; } cout<< "Student's school number, name, total score, average score;" <<endl; for (i=0;i<n;i++) cout<<stu[i].num<< "" <<stu[i].name<< "" <<stu[i].grade< < "" <<stu[i].average<<endl; return 0;}
Operation Result:
@ Mayuko
17th Week Item 6-Student Achievement Statistics (i)