mshd.net
当前位置:首页 >> C++问题,构造一个学生类 >>

C++问题,构造一个学生类

class Students{ private : long number; double grade1, grade2, grade3; char address[100]; char contect[50]; public : void setNumber(long number); void setGrade1(Double grade1); void setGrade2(Double grade2); void setGrade3(Doubl...

#include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ using namespace std; /* 学生的基本信息 */ struct st_info{ int id; char name[30]; double grade; }; /* 创建一...

#include #include using namespace std; class Student { private: string name; string code; int age; public: Student() { name = ""; //其实这里不需要初始化,因为string定义的变量已经初始化为空了 code = ""; age = 0; } Student(string...

#include "iostream.h" #include "string.h" class student { private: string Num; string Name; int C; int math; int Chinese; public: student() { Num=" "; Name=" " ; C=0; math=0; Chinese=0; } ~student() { } void setstuInfo() { cout...

#define _CRT_SECURE_NO_WARNINGS#include #include using namespace std;//创建学生类class student{public:student(){} //构造函数void insertInfo(){cout name >> num >> qzScore >> qmScore >> psScore;countScore = psScore*0.4 + 0.2*qzSc...

#include #include using namespace std; class CStudent { public: CStudent(); float sum(); float average(); void print_inf(); int get_reg_num(); void set_stu_inf(int x,char* na,float s,float y,float j); private: int no;//学号 cha...

定义一个学生类,里面包含了学生的姓名、四科成绩和平均成绩的成员变量,计算平均分的成员函数。在学生类的构造函数里对学生的姓名和成绩做初始化。然后你实例化5个学生变量就可以了。 CStudent { private: char mName[20]; float mScore[4]; pu...

#include#include using namespace std;class Student{public: Student(){}friend ostream & operator(istream&,Student&);private:string name;int age;};ostream & operator stu.age;return stream;}int main(){Student stu;cin >> stu; // 将...

//xx.h#include#includeusing namespace std;class student{private:string name; //姓名string sex; //性别int age; //年龄string ID; //学号string department; //系别double mathScore; //数学成绩double englishScore; //英语成绩double phy...

#include #include using namespace std;class Student{public: // 带参数的构造函数初始化对象 Student(int id, string name, double score) : id(id), name(name), score(score) { count++; total+=score; } // 修改分数成员函数 void ChangeS...

网站首页 | 网站地图
All rights reserved Powered by www.mshd.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com