#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;
OJ k
最新推荐文章于 2020-11-30 17:06:52 发布