本文主要是介绍输入3个学生的学号、姓名和三门功课成绩,输出平均分最高的同学,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
新建一个学生类Student.h:属性有姓名、学号、三门功课成绩
#include<string>
using namespace std;
class Student
{
public:Student():classA_score(0), classB_score(0), classC_score(0){ }void setClassA_score(double A_score);void setClassB_score(double B_score);void setClassC_score(double C_score);void setName(string name);void setNo_number(string no_num);double getClassA_score();double getClassB_score();double getClassC_score();double getAverage_score();string getName();string getNo_number();
private:string stu_name;double classA_score;double classB_score;double classC_score;string No_number;
};
#include"Student.h"void Student::setName(string name)
{stu_name = name;
}
void Student::setNo_number(string no_num)
{No_number = no_num;
}
void Student::setClassA_score(double A_score)
{classA_score =
这篇关于输入3个学生的学号、姓名和三门功课成绩,输出平均分最高的同学的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!