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

正文內(nèi)容

面向?qū)ο蟪绦蛟O(shè)計(jì)c試驗(yàn)題目-閱讀頁

2025-06-25 02:16本頁面
  

【正文】 rror!。出棧和出隊(duì)時(shí),若非空,則輸出被刪除的學(xué)生信息;若??眨瑒t輸出Stack is empty!;若隊(duì)空,則輸出Queue is empty!。輸入樣例:PushZhangSan 200905PushLiSi 200906EnQueueWangWu 200907PopexitExit輸出樣例:Name: LiSi, Number: 200906Input error!提示:include iostreaminclude stringusing namespace std。name=, int number=0):stuName(name),stuNo(number) { } ~StudentRecord() { } void Print()。 int stuNo。void StudentRecord::Print(){ cout Name: stuName , Number: stuNo endl。stu, StudentNode *pNext=NULL): data(stu), next(pNext) { } ~StudentNode() { }public: StudentRecord data。 // 指針域}。 } } StudentNode* HeadNode() { return head。 } void FrontInsert(const StudentRecordamp。 tnext = head。 } void FrontRemove() { if(head != 0) { StudentNode *t = head。 delete t。 stu) { StudentNode *t = new StudentNode(stu)。 } else { head = t。 } void Print() { StudentNode *t = head。 } }public: StudentNode *head。}。 } bool Pop(StudentRecord amp。 FrontRemove()。 } else { return false。class LinkedQueue:public LinkedList{public: void EnQueue(StudentRecord record) { BackInsert(record)。record) { if(head != 0) { record = HeadNode()data。 return true。 } }}。 LinkedStack stack。 while(szOp!=Exit) { cin szOp。 int num。 (StudentRecord(name, num))。 int num。 (StudentRecord(name, num))。 if((stu)) { ()。 } } else if(szOp == DeQueue) { StudentRecord stu。 } else { cout Queue is empty! endl。 } else { cout Input error! endl。}實(shí)驗(yàn)五 虛函數(shù)與操作符重載標(biāo)題:抽象類與操作符重載時(shí)ms內(nèi)存限制:10000ms描述:定義表示形狀的抽象類及相應(yīng)的派生類,并實(shí)現(xiàn)相關(guān)操作符重載。 H: 高度。(3)從形狀類Shape派生橢圓類Ellipse:添加double型的保護(hù)數(shù)據(jù)成員:rectWidth和rectHeight,分別表示橢圓外接矩形的寬度和高度;定義帶參構(gòu)造函數(shù);重定義公有成員函數(shù)Show,打印橢圓外接矩形的寬度和高度,輸出格式為“W: 寬度。 Area: 面積”;重定義公有成員函數(shù)Area,計(jì)算橢圓面積。在main函數(shù)中,首先根據(jù)輸入的整數(shù)創(chuàng)建相應(yīng)大小的Shape對(duì)象指針數(shù)組,再根據(jù)輸入的對(duì)象類型和信息動(dòng)態(tài)創(chuàng)建相應(yīng)類型的對(duì)象,并關(guān)聯(lián)到對(duì)象指針數(shù)組。 // 對(duì)象指針數(shù)組的元素個(gè)數(shù)R 23 17 // 對(duì)象類型、形狀寬度、形狀高度,R表示矩形對(duì)象E 17 29接著通過調(diào)用Show成員函數(shù)輸出所有對(duì)象的信息。 H:17。 H:25。 H:23。 H:17。 H:75。 H:29。 H:75。 H:25。 H:23。 H:17。 H:17。 H:29。include iostreaminclude stringinclude cmathusing namespace std。// 定義表示形狀的抽象類class Shape{public: Shape() {} virtual ~Shape() {} virtual double Area()=0。 friend bool operator==(Shape amp。shRight)。shLeft, Shape amp。 friend bool operator(Shape amp。shRight)。bool operator==(Shape amp。shRight){ return abs(() ()) = 。shLeft, Shape amp。}bool operator(Shape amp。shRight){ return () ()。 double Area()。private: double rectWidth。}。}void Rectangle::Show(){ cout W: rectWidth 。 Area: Area() endl。 double Area()。private: double rectWidth。}。}void Eclipse::Show(){ cout W: rectWidth 。 Area: Area() endl。 cin shNum。 // 根據(jù)輸入的信息依次創(chuàng)建對(duì)應(yīng)的形狀對(duì)象 char shType。 // 外接矩形的寬度和高度 for(int i=0。 i++) { cin shType w h。R39。 break。E39。 break。 ishNum。 } // 比較所有形狀對(duì)象,輸出面積相等的兩個(gè)形狀對(duì)象對(duì)應(yīng)的數(shù)組下標(biāo) for(int i=0。 i++) { for(int j=i+1。 j++) { if(*shArr[i] == *shArr[j]) { cout Area of Shape[ i ] is equal to Shape[ j ] endl。 Shape* shTemp。 ishNum1。 for(int j=i+1。 j++) { if(*shArr[j] *shArr[k]) { k =j。 shArr[i] = shArr[k]。 } // 輸出排序后的對(duì)象信息 for(int i=0。 i++) { shArr[i]Show()。 ishNum。 } delete[] shArr。}標(biāo)題:虛函數(shù)時(shí)ms內(nèi)存限制:10000ms描述: (1)設(shè)計(jì)Person類,要求具有用于表示姓名的保護(hù)數(shù)據(jù)成員:string szName; 實(shí)現(xiàn)信息打印的公有成員函數(shù):void Print()。其中,Print函數(shù)輸出的信息格式為:“Student 姓名 學(xué)號(hào)”。 (3)從 Person類派生Teacher類,添加用于表示教齡的保護(hù)數(shù)據(jù)成員:int iYear;重定義用于信息打印的公有成員函數(shù):void Print()。其中,Print函數(shù)輸出的信息格式為:“Graduate 姓名 研究方向”。用戶依次輸入對(duì)象信息(對(duì)象類別及其相應(yīng)的數(shù)據(jù)成員值),根據(jù)對(duì)象類別動(dòng)態(tài)創(chuàng)建相應(yīng)的對(duì)象并賦給相應(yīng)的對(duì)象指針數(shù)組元素。如果用戶輸入“exit”,則退出。輸出:用戶要求顯示的對(duì)象信息。include iostreaminclude stringinclude cstdlibusing namespace std。 name)。protected: string szName。Person::Person(const stringamp。}class Student : public Person{public: Student(const stringamp。 void Print() const。}。 name, int number):Person(name),iNumber(number){}void Student::Print() const{ cout Student szName iNumber endl。 name, int year)。protected: int iYear。Teacher::Teacher(const stringamp。}class Graduate : public Student{public: Graduate(const stringamp。 void Print() const。}。 name, int number, string major): Student(name, number), szResearch(major){}void Graduate::Print() const{ cout Graduate szName iNumber szResearch endl。 cin psNum。 // 對(duì)象類型、姓名、學(xué)號(hào)、教齡、研究方向 string szType, szName, szMajor。 // 根據(jù)輸入的對(duì)象信息創(chuàng)建不同類型的對(duì)象 for(int i=0。 i++) { cin szType。 psArr[i] = new Person(szName) 。 psArr[i] = new Student(szName, iNumber)。 psArr[i] = new Teacher(szName, iYear)。 psArr[i] = new Graduate(szName, iNumber, szMajor)。 int objIdx。 while(szIdx != exit) { // 對(duì)象下標(biāo) objIdx = atoi(())。 // 輸出對(duì)象信息 psArr[objIdx]Print()。 }
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)教案相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1