freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c電子課件(下)第八章-資料下載頁(yè)

2024-12-23 12:16本頁(yè)面
  

【正文】 ntStudentInfo(){ int i。 cout學(xué)號(hào) :NoStudent39。\n39。 PrintPersonInfo()。 for(i=0。i30。i++) //打印各科成績(jī) if(cs[i].coursename!=) coutcs[i].coursename 39。\t39。cs[i].grade39。\n39。 else break。 cout完 endl。 } 打印學(xué)生情況函數(shù): 例 : int main(void){ char temp[30]。 int i,k。 Person per1(320212820818161,沈俊 , man,19820818,南京四牌樓 2號(hào) )。 Person per2。 (朱明 )。 (woman)。 (19780528)。 (320212780528162)。 (南京市成賢街 9號(hào) )。 ()。 ()。 Student stu1(320212811226161,朱海鵬 , man,19811226,南京市黃浦路 1號(hào) ,06000123)。 cout請(qǐng)輸入各科成績(jī) :39。\n39。 //完整的程序應(yīng)輸入學(xué)號(hào) ,查找 ,再操作 while(1){ //輸入各科成績(jī) ,輸入 end停止 cintemp。 //輸入格式 :物理 80 if(!strcmp(temp,end)) break。 cink。 i=(temp,k)。 if(i==0) cout成績(jī)列表已滿 !39。\n39。 else if(i==1) cout修改成績(jī) 39。\n39。 else cout登記成績(jī) 39。\n39。 } ()。 while(1){ cout查詢成績(jī) 39。\n39。請(qǐng)輸入科目 :39。\n39。 cintemp。 if(!strcmp(temp,end)) break。 k=(temp)。 if(k==1) cout未查到 39。\n39。 else coutk39。\n39。 } return 0。} 【 例 】 由圓和高多重繼承派生出圓錐 class Circle{ protected: float x,y,r。 //(x,y)為圓心 ,r為半徑 public: Circle(float a=0,float b=0,float R=0){x=a。y=b。r=R。} void Setcoordinate(float a,float b){x=a。y=b。} //設(shè)置圓心坐標(biāo) void Getcoordinate(float amp。a,float amp。b){a=x。b=y。} void SetR(float R){r=R。} //設(shè)置半徑 float GetR(){return r。} //取圓半徑 float GetAreaCircle(){return float(r*r*)。} //取圓面積 float GetCircumference(){return float(2*r*)。} //取圓周長(zhǎng) }。 高類 Line: 【 例 】 由圓和高多重繼承派生出圓錐 class Line{ protected: float High。 public: Line(float a=0){High=a。} void SetHigh(float a){High=a。} float GetHigh(){return High。} }。 class Cone:public Circle,public Line{ public: Cone(float a,float b,float R,float d):Circle(a,b,R),Line(d){} float GetCV(){return float(GetAreaCircle()*High/3)。} //取得圓錐體積 float GetCA(){ //取得圓錐表面積 return float(GetAreaCircle()+r**sqrt(r*r+High*Hgih))。 }。 //共有派生類中能直接訪問(wèn)直接基類的保護(hù)成員 【 例 】 由圓和高多重繼承派生出圓錐 派生類圓錐: 在 VC++平臺(tái)上運(yùn)行例 int main(){ Cone c1(5,8,3,4)。 float a,b。 cout圓錐體積 :()39。\n39。 cout圓錐表面積 :()39。\n39。 cout圓錐底面積 :()39。\n39。 cout圓錐底周長(zhǎng) :()39。\n39。 cout圓錐底半徑 :()39。\n39。 (a,b)。 cout圓錐底圓心坐標(biāo) :(a39。,39。b)\n。 cout圓錐高 :()39。\n39。 return 0。 } 【 例 】 由圓和高多重繼承派生出圓錐 檢證主程序: class Student:public virtual Person{ string NoStudent。 //學(xué)號(hào) //30門課程與成績(jī)略 public: Student(string id, string name,Tsex sex,int birthday, string homeadd, string nostud)。 Student()。 ~Student(){cout析構(gòu) Studentendl。} void PrintStudentInfo()。 }。 Student::Student(string id, string name,Tsex sex, int birthday, string homeadd, string nostud) :Person(id,name,sex,birthday,homeadd){ //注意 Person參數(shù)名表不用類型 cout構(gòu)造 Studentendl。 NoStudent=nostud。} [例 ] 虛基類與在職研究生 以虛基類定義公有派生的學(xué)生類: Student::Student(){ //基類默認(rèn)的無(wú)參數(shù)構(gòu)造函數(shù)不必顯式給出 cout構(gòu)造 Studentendl。 } void Student::PrintStudentInfo(){ cout學(xué)號(hào) :NoStudent39。\n39。 PrintPersonInfo()。 } [例 ] 虛基類與在職研究生 以虛基類定義公有派生的學(xué)生類: class GStudent:public Student{ //以虛基類定義公有派生的研究生類 string NoGStudent。 //研究生號(hào),其他略 public: GStudent(string id, string name,Tsex sex,int birthday, string homeadd, string nostud,string nogstudent)。 //注意派生類構(gòu)造函數(shù)聲明方式 GStudent()。 ~GStudent(){cout析構(gòu) GStudentendl。}。 void PrintGStudentInfo()。}。 GStudent::GStudent(string id, string name,Tsex sex, int birthday, string homeadd, string nostud, string nogstud): Student(id,name,sex,birthday,homeadd,nostud), Person(id,name,sex,birthday,homeadd){ //因 Person是虛基類 ,盡管不是直接基類 , Person必須出現(xiàn)。 //不定義對(duì)象可不出現(xiàn),為通用應(yīng)出現(xiàn)。如不是虛基類,出現(xiàn)是錯(cuò)誤的 cout構(gòu)造 GStudentendl。 NoGStudent=nogstud。} [例 ] 虛基類與在職研究生 以虛基類定義公有派生的研究生類: GStudent::GStudent(){ //基類默認(rèn)的無(wú)參數(shù)構(gòu)造函數(shù)不必顯式給出 cout構(gòu)造 GStudentendl。 } void GStudent::PrintGStudentInfo(){ cout研究生號(hào) :NoGStudent39。\n39。 PrintStudentInfo()。 } [例 ] 虛基類與在職研究生 以虛基類定義公有派生的研究生類: [例 ] 虛基類與在職研究生 class Employee:public virtual Person{ string NoEmployee。 //教職工號(hào),其他略 public: Employee(string id, string name,Tsex sex,int birthday, string homeadd, string noempl)。 Employee()。 ~Employee(){cout析構(gòu) Employeeendl。} void PrintEmployeeInfo()。 void PrintEmployeeInfo1()。//多重繼承時(shí)避免重復(fù)打印虛基類 Person的信息 }。 Employee::Employee(string id, string name,Tsex sex,int birthday, string homeadd, string noempl) :Person(id,name,sex,birthday,homeadd){ cout構(gòu)造 Employeeendl。 NoEmployee=noempl。 } 以虛基類定義公有派生的教職工類: [例 ] 虛基類與在職研究生 Employee::Employee(){ //基類默認(rèn)的無(wú)參數(shù)構(gòu)造函數(shù)不必顯式給出 cout構(gòu)造 Employeeendl。 } void Employee::PrintEmployeeInfo(){ cout教職工號(hào) :NoEmployee39。\n39。 PrintPersonInfo()。 } void Employee::PrintEmployeeInfo1(){ cout教職工號(hào) :NoEmployee39。\n39。 } 以虛基類定義公有派生的教職工類: [例 ] 虛基類與在職研究生 class EGStudent:public Employee,public GStudent{ string NoEGStudent。 //在職學(xué)習(xí)號(hào),其他略 public: EGStudent(string id, string name,Tsex sex,int birthday,string homeadd, string nostud,string nogstud, string noempl, string noegstud)。 EGStudent()。 ~EGStudent(){cout析構(gòu) EGStudentendl。}。 void PrintEGStudentInfo()。}。 EGStudent::EGStudent(string id, string name,Tsex sex,int birthday, string homeadd,string nostud, string nogstud, string noempl, string noegstud) :GStudent(id,name,sex,birthday,homeadd,nostud,nogstud), Employee(id,nam
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1