OJ k

来源:互联网 发布:中国特种作业数据库 编辑:程序博客网 时间:2024/05/12 13:14
#include <iostream>using namespace std;class Score{public:    void get();    bool pass();    int av();    int getnum()    {        return studnum;    }    int getchinese()    {        return Chinese;    }    int getmath()    {        return Math;    }    int getenglish()    {        return English;    }private:    int studnum;    int Chinese;    int Math;    int English;};void Score::get(){ cin>>studnum>>Chinese>>Math>>English;}int Score::av(){    return (Chinese+Math+English)/3;}bool Score::pass(){    if(Chinese>=60&&Math>=60&&English>=60)    {        return true;    }    return false;}int main(){    Score s;    s.get();    cout<<"student:"<<s.getnum()<<endl;    cout<<s.av()<<endl;if(s.pass()){    cout<<"pass"<<endl;}else{   if(s.getchinese()<60)        cout<<"Chinese"<<endl;        if(s.getmath()<60)        cout<<"Math"<<endl;        if(s.getenglish()<60)        cout<<"English"<<endl;} return 0;

0 0
原创粉丝点击