学生成绩及格与不及格

//02.* Copyright (c) 2013, 烟台大学计算机学院   
//04.* 作    者: 马德鹏   
//05.* 完成日期:2014 年 6 月 29 日   
//06.* 版 本 号:v1.0   
//07.* 
#include <iostream>
using namespace std;
struct Student
{
    public:
    void set();
    void show();
    private:
    double num;
    int Chinese;
    int Math;
    int English;
    int save;
}stu;
void Student::set()
{
    cin>>stu.num>>stu.Chinese>>stu.Math>>stu.English;
      stu.save=(stu.Chinese+stu.Math+stu.English)/3;
    cout<<"student:"<<stu.num<<endl;
    cout<<stu.save<<endl;
}
void Student::show()
{
    if(stu.Chinese>=60&&stu.Math>=60&&stu.English>=60)
    {
        cout<<"pass";
    }
     if(stu.Chinese<60)
    {
        cout<<"Chinese"<<endl;
    }
    if(stu.Math<60)
    {
        cout<<"Math"<<endl;
    }
    if(stu.English<60)
    {
        cout<<"English"<<endl;
    }
}
int main()
{
  stu.set();
  stu.show();
    return 0;
}

猜你喜欢

转载自blog.csdn.net/u012369154/article/details/36177887