Description
Xiao Ping helped the teacher to have a problem with his final grade. He needs to calculate the average scores of each student and determine if they pass the final exam (<60), if they pass the pass, if they fail to indicate which subjects failed. So he needed two functions, one for averaging (regardless of decimals), another to determine whether to pass an exam, to output a pass, or to output a failed account. Please help him!
The final period includes the chinese,math,english of the course.
Input
Enter the study number and enter three subjects, the three account names are chinese,math,english to represent each other.
Output
The output number, and the output with the number corresponding to the average score, and hang subjects (all over the output of a pass).
One row for each output item, and one row for each of the hanging subjects.
Sample Input
1001 60 60 60
Sample Output
Student:100160pass
/* All rights reserved. * File name: Test.cpp * Chen Dani * Completion date: June 25, 2015 * Version number: v1.0 */#include <iostream>using namespace Std;class Student{private:int num; int Chinese; int Math; int english;public:void get_grade (); void Show (); void average (); int get_num ();}; int Student::get_num () {return num;} void Student::get_grade () {cin>>num>>chinese>>math>>english;} void Student::average () {int A; A= (Chinese+math+english)/3; Cout<<a<<endl;} void Student::show () {if (chinese>=60&&math>=60&&english>=60) cout<< "Pass" << Endl if (chinese<60) cout<< "Chinese" <<endl; if (math<60) cout<< "Math" <<endl; if (english<60) cout<< "中文版" <<ENDL;} int main () {Student s; S.get_grade (); cout<< "Student:" <<s.get_num () <<endl; S.average (); S.show (); return 0;}
Learning experience: The problem is very simple, although a little problem, but all correct, and continue to work!!!
16th Week OJ Brush question--problem B: processing results (c + + training)