void display輸出函式
void input輸入函式
void min(student*,int); //求最低成績函式
void sort(student*,int); //按照成績高低排序函式
//protected這裡是保護成員 //這裡是vc6.0的原因
string num; //學號
string name; //姓名
char ***性別
date birthday; //生日
int score; //成績
};//以下內容是增加繼承後增添的
class doctor:public student //定義doctor類,是student的派生類
;//以上內容是增加繼承後增添的
成員函式的定義
#include""
date::date無參建構函式
date::date(int y,int m,int d) //有參建構函式
date::~date析構函式-函式體為空
student::student無參建構函式,自動賦值
student::student(string n,string nam,char s,date bir,int c) //有參建構函式,將引數值賦給成員
student::~student() //析構函式-函式體為空
void student::display輸出學生資訊函式
void student::input() //輸入學生資訊函式
void student::sort(student *p,int n) //按照成績高低排序函式
void student::min(student *p,int n) //求最低成績函式
p++;
}cout<<"學生成績最低者資訊 :"< cout<<"num="< cout<<"name="< cout<<"***="< cout<<"birthday:"<<<<"-"<<<<"-"<<< cout<<"score="< }
//以下內容是增加繼承後增添的
doctor::doctor()
doctor::doctor(string t,int c)
void doctor::display1()
void doctor::set()
void doctor::sort(doctor *p,int n) //按照科研分值高低排序函式
{ int i,j;
string temp_num,temp_name;
char temp_***;
date temp_bir;
int temp_score;
string temp_thesis;
int temp_sci_value;
for(i=0;i for(j=i+1;jif(p[i].sci_value
temp_num=p[i].num;
p[i].num=p[j].num;
p[j].num=temp_num;
temp_name=p[i].name;
p[i].name=p[j].name;
p[j].name=temp_name;
temp_***=p[i].***;
p[i].***=p[j].***;
運算子過載
一 運算子過載的概念 運算子過載允許把標準運算子重定義,使之對指定型別的物件執行指定的操作。注意 1 一般地,運算子過載函式由關鍵字operator和要過載的運算子組成,對於用字母表示的運算子,例如new和delete,在關鍵字和運算子之間至少有乙個空格。對於其它運算子,空格可選。2 過載運算子不准...
移位運算子詳解
移位運算子就是在二進位制的基礎上對數字進行平移。按照平移的方向和填充數字的規則分為三種 左移 帶符號右移 和 無符號右移 在移位運算時,byte short和char型別移位後的結果會變成int型別,對於byte short char和int進行移位時,規定實際移動的次數是移動次數和32的餘數,也就...
Java位運算子詳解
按位與運算子 參加運算的兩個資料,按二進位制位進行 與 運算。運算規則 0 0 0 0 1 0 1 0 0 1 1 1 即 兩位同時為 1 結果才為 1 否則為0 例如 3 5 即 0000 0011 0000 0101 0000 0001 因此,3 5的值得1。另,負數按補碼形式參加按位與運算。與...