16th Week OJ Brush question--problem B: processing results (c + + training)

Source: Internet
Author: User

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<< "中文版" &LT;&LT;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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.