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

正文內(nèi)容

倉庫商品檢查登記管理系統(tǒng)-文庫吧

2025-03-23 12:07 本頁面


【正文】 公有函數(shù),還要有一個1個3個參數(shù)的函數(shù) SetCat。設(shè)計Display函數(shù)輸出貓的信息。include iostreamclass Cat{private String colour。private int weight。private int age。...int getWeight(){ return weight。}int getAge(){ return age。}void setClolur(String xClolour){ colour=xCloour。}void setWeight(int xWeight){ weight=xWeight。}void setAge(int xAge) { age=xAge。}} 設(shè)計一個表示學(xué)習(xí)成績的類,至少包括三門課程的成績,可以設(shè)置、顯示每門課程的成績,可以計算、顯示平均成績。 class Grades{private: int Math,English,Chinese。public: Grades() { Math = English = Chinese = 0。} Grades(int a,int b,int c) { Math = a。 English = b。 Chinese = c。 } int getM(){ return Math。} int getE(){ return English。} int GetC(){ return Chinese。} void Setvalue(int a,int b,int c) { Math = a。 English = b。 Chinese = c。 } void Display()。 float Average() { return (Math+English+Chinese)/。 }}設(shè)計成績類,成績類的數(shù)據(jù)成員,應(yīng)該包括學(xué)生的學(xué)號Number[10]和姓名Name[9],假設(shè)有3門課,分別為C++程序設(shè)計語言,用整型變量Cpp表示;計算機原理,用整型變量Computer表示;數(shù)據(jù)庫,用整型變量DataBase表示。平均成績用實型變量Average表示。為了Grade類數(shù)據(jù)的安全性,數(shù)據(jù)成員全部為私有成員,對成績類的屬性數(shù)據(jù)用一些函數(shù)進行設(shè)置和修改,PutNo為設(shè)置和修改學(xué)號,PutName為設(shè)置和修改姓名,PutCpp為設(shè)置和修改C++程序設(shè)計語言的成績,PutCom為設(shè)置和修改計算機原理的成績,PutData為設(shè)置和修改數(shù)據(jù)庫的成績,還有一個同時設(shè)置所有5個參數(shù)的函數(shù)SetGrade,它們都設(shè)置為公有函數(shù)。計算平均成績的函數(shù)為Calc,設(shè)計函數(shù)Display輸出成績。有時可能要查看某個學(xué)生的成績,所以設(shè)計比較學(xué)號的函數(shù)為ComNo,設(shè)計比較姓名的函數(shù)為ComName,GetCpp為讀取C++程序設(shè)計語言的成績,GetCom為讀取計算機原理的成績,GetData為讀取數(shù)據(jù)庫的成績,設(shè)計讀取平均成績的函數(shù)為GetAvg。計算平均成績只是在類的內(nèi)部實現(xiàn),所以設(shè)計為私有函數(shù),其它都為公有函數(shù)。綜合實訓(xùn)設(shè)計一個表示整型數(shù)據(jù)的集合類,可以對集合中的數(shù)據(jù)進行添加、刪除,可以判斷一個整數(shù)是否在這個集合里,可以求出集合數(shù)據(jù)的多少,可以判斷集合的空與滿,空集合就是沒有數(shù)據(jù)元素,滿集合就是數(shù)據(jù)元素已經(jīng)占滿給出的存儲單元。兩個集合可以做交運算,就是將兩個集合的公共數(shù)據(jù)組成一個新的集合。兩個集合可以做并運算,就是將兩個集合的所有數(shù)據(jù)組成一個新的集合。要求如下:(1)分析集合類的數(shù)據(jù)屬性要求;(2)分析集合類的操作屬性要求;(3)編制集合類的接口定義;(4)實現(xiàn)集合類的屬性函數(shù)。include//form the datastruct Data{ long num。 Data *next。}。//the set classclass Gather{ public: Gather(int =5)。 //~Gather()。 void form(int)。 void del()。 void setGather()。 void print()。 void add(int)。 Data *getptr(){return ptr。} Gatheramp。 operator=(Gather amp。)。 Gatheramp。 operator+(Gather amp。)。 Gatheramp。 operator*(Gather amp。)。 private: int LEN。 Data *ptr。}。Gather inside。Gather::Gather(int a){form(a)。}void Gather::form(int a){ LEN=a。 Data *p。 for (int i=0。ia。i++){ if(i==0){ ptr=new Data。 p=ptr。 } else { pnext=new Data。 p=pnext。 } } pnext=NULL。}//Gather::~Gather(){del()。}void Gather::del(){ Data *p。 Data *q。 p=ptr。 for(int i=0。iLEN。i++){ q=p。 p=pnext。 delete q。 } LEN=0。}void Gather::setGather(){ Data *p。 p=ptr。 for (int i=0。iLEN。i++){ coutEnter item i+1 :。 cinpnum。 p=pnext。 }}void Gather::print(){ if (LEN==0) coutIt39。s an empty set!endl。 Data *p。 p=ptr。 for(int i=0。iLEN。i++){ coutpnum 。 p=pnext。 if (i!=0amp。amp。i%10==0) coutendl。 }}void Gather::add(int t){ bool y=true。 Data *p。 p=ptr。 for(int i=0。iLEN。i++){ if (pnum==t){ y=false。 break。 } if(i!=LEN1)p=pnext。 } if(y){ pnext=new Data。 p=pnext。 pnum=t。 pnext=NULL。 LEN++。 }}Gatheramp。 Gather::operator =(Gather amp。x){ if (ptr==) return *this。 else { del()。 form()。 Data *p,*q。 p=ptr。 q=。 for(int i=0。i。i++){ pnum=qnum。 p=pnext。 q=qnext。 } return *this。 }}Gatheramp。 Gather::operator +(Gather amp。x){ ()。 (LEN)。 Data *q。 Data *p。 q=ptr。 p=()。 for(int i=0。iLEN。i++){ pnum=qnum。 p=pnext。 q=qnext。 } q=。 for(i=0。i。i++){ (qnum)。 q=qnext。 } return inside。}Gatheramp。 Gather::operator *(Gather amp。x){ int z=0。 long g[100]。 bool y=true。 Data *p。 Data *q。 p=ptr。 q=。 for(int i=0。iLEN。i++){ q=。 for(int j=0。j。j++){ if (pnum==qnum){ for(int t=0。tz。t++) if (pnum==g[t]){ y=false。 break。 } if(y){ g[z]=pnum。 z++。 break。 } y=true。 break。 } else q=qnext。 } p=pnext。 } ()。 (z)。 Data *pre。 pre=()。 for (i=0。iz。i++){ prenum=g[i]。 pre=prenext。 } return inside。}//the mainint main(){ Gather x(6)。 Gather y。 Gather result。 coutEnter the item of set x:endl。 ()。 coutThe items of x is:endl。 ()。 coutendl。 coutEnter t
點擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1