?? student.h
字號:
// student.h define the class of student
#ifndef STUDENT_H_
#define STUDENT_H_
#include <iostream>
#include <fstream>
using namespace std;
class Student{
private:
char *name;//name of student
char *snumber;//student number
int age;
char sex;
int chinese;
int math;
int english;
int total;
double avag;
void set_tot(){ total = chinese + math + english; }
void set_ava(){ avag = total/3.0; }
public:
void outfilestream(ofstream &ofs);
void infilestream(ifstream &ifs);
int get_key(int chioce); //獲得排序關鍵字
//constructor and destructor
Student();//default constructor
Student(char *n,char *sn, int a, char s,int y = 0,int m = 0,int e = 0);
~Student();//noisy destructor
Student(const Student &st);
//reset the members of the student class
void set_name(const char *n);
void set_sn(char *sn);
void set_age(int a);
void set_sex(char s);
void set_chinese(int yw);
void set_math(int m);
void set_english(int e);
void set_pfm(int y, int m, int e);
//get the value of the class
char * get_n()const;
char * get_sn()const;
int get_age()const;
char get_sex()const;
int get_chinese()const;
int get_math()const;
int get_english()const;
double get_ava()const;
int get_tot()const;
//overloaded operator methods
Student & operator = (const Student & stu);
//print
void showall()const;
void showpfm()const;
//friend methods
friend istream & operator >>(istream & is, Student & stu);
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -