处理成绩

/*
*Copyright (c) 2014 ,烟台大学计算机学院
*All rights reserved.
*作者:张凤宁
*完成日期:2014年8月5
*版本号:v1.0
*问题描述:
*样例输入:
*样例输出:
*问题分析:用简单的方法,学会活学活用
*/
#include<string>
#include <iostream>
using namespace std;
class Student
{
public:
    Student() {}
    Student(int n,int ch,int m,int eng);
    void get_value();
    int area();
    void pass();
    void display();
private:
    int num;
    int Chinese;
    int Math;
    int English;
};
Student::Student(int n,int ch,int m,int eng):num(n),Chinese(ch),Math(m),English(eng) {}
void Student::get_value()
{
    cin>>num;
    cin>>Chinese;
    cin>>Math;
    cin>>English;
}
int Student::area()
{
    return ((Chinese+Math+English)/3);
}
void Student::pass()
{
    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<<"English"<<endl;
    }
}
void Student::display()
{
    cout<<"student:"<<num<<endl;
}
int main( )
{
    Student s1;
    s1.get_value();
    s1.display();
    cout<<s1.area()<<endl;
    s1.pass();
    return 0;
}













评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值