使用InputBox函数输入学生的计算机,英语,数学成绩,然后用MsgBox函数输出平均成绩
2013-04-17
展开全部
#include
using namespace std;
class stu
{
public:
void inputebox(int a, int b, int c);
double msgbox();
private:
int math;
int english;
int computer;
};
void stu::inputebox(int a, int b, int c)
{
computer = a;
math = b;
english = c;
}
double stu::msgbox()
{
return ( math + english + computer ) / 3.0;
}
int main()
{
stu child;
int m , n , s;
cout<<"请输入学生的计算机、数学、英语成绩:"<> m >> n >> s;
child.inputebox(m , n , s);
cout<<"他这三门课的平均成绩是:"<<child.msgbox()<<endl;
system("pause");
return 0;
}
using namespace std;
class stu
{
public:
void inputebox(int a, int b, int c);
double msgbox();
private:
int math;
int english;
int computer;
};
void stu::inputebox(int a, int b, int c)
{
computer = a;
math = b;
english = c;
}
double stu::msgbox()
{
return ( math + english + computer ) / 3.0;
}
int main()
{
stu child;
int m , n , s;
cout<<"请输入学生的计算机、数学、英语成绩:"<> m >> n >> s;
child.inputebox(m , n , s);
cout<<"他这三门课的平均成绩是:"<<child.msgbox()<<endl;
system("pause");
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询