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

正文內(nèi)容

c程序設(shè)計(jì)課后習(xí)題參考答案(參考版)

2025-06-28 15:54本頁面
  

【正文】 days,sizeof days);}。習(xí)題13參考答案一、 選擇題1.B 2.C 3.C 4.B 5.A二、填空題1.istream, ostream2., 3.write , put4.get, getline, read5.rdstate()三、編程題定義一個(gè)數(shù)據(jù)文件,并向其中輸入數(shù)據(jù)。應(yīng)用類模板也可以使編程得到簡化。739。k39。h39。e39。z39。g39。239。A39。d39。i39。amp。}3.用函數(shù)模板設(shè)計(jì)一個(gè)SortT函數(shù)模板,完成對整型和字符數(shù)組進(jìn)行排序。};couta數(shù)組中最大數(shù)是Max(a,6)endl;coutc數(shù)組中最大元素是Max(c,7)endl;}2.設(shè)計(jì)一個(gè)類模板StoreT用于存儲某一類型的數(shù)據(jù),并用整型數(shù)據(jù)和字符串?dāng)?shù)據(jù)檢驗(yàn)其正確性。39。39。39。39。39。39。程序設(shè)計(jì)如下: includeiostream.htemplateclass TT Max(T a[],int n){T temp=a[0];for(int i=1;in;i++)if(tempa[i])temp=a[i];return temp;}void main(){int a[]={5,8,3,222,9,123};char c[]={39。程序設(shè)計(jì)如下:includeiostream.hclass P{public:virtual void fun(){coutP::fun() called.\n;}};class Q:public P{public:virtual void fun(){coutQ::fun() called.\n;}};void main(){Q q;P amp。程序設(shè)計(jì)如下:includeclass X{public:virtual void Display(int x,float y){coutx,yend1;}};Class Y:public X{public:virtual void Display(int x,float y){coutx,yend1;}};void Scrren(X amp。}習(xí)題11參考答案一、 選擇題1.C 2.D 3.A 4.C 5.D二、填空題1.用同一個(gè)運(yùn)算符完成不同的,通過創(chuàng)建運(yùn)算符函數(shù)。t. Print()。stu. Print()。Teacher t(Tim,Computer,C++)。void main (){Student stu(Mike,Software Enginerring)。coutLesson:lessonendl。class StudentTeacher:public Student,public Teacher{public:StudentTeacher(const char*n,const char*m, const char*d, const char*1):Person(n),Student(n,m),Teacher(n,d,l){}void Print() const{Student::Print()。程序設(shè)計(jì)如下:includeint GetSum(int n);class Person{public:Person(const char*n){name=new char[strlen(n)+1];strcpy(name,n);}void Print() const {coutName:nameend1;}protected:char*name;};class student:virtual public Person{public:Student(const char*n,const char*m):Person(n){major=new char[strlen(m)+1];strcpy(major,m);}void Print() const{Person::Print();coutMajor:endl;}protected:char* major;};class Staff:virtual public Person{public:Staff(const char*n,const char*d):Person(n){dept=new char[strlen(d)+1];strcpy(dept,d);}void Print() const{Person::Print();coutDepartment:deptendl;}protected:char* dept;};Class Teacher:public Staff{public:Teacher(const char*n,const char*d,const char*1):Person(n),Staff(n,d){lesson=new char[strlen(1)+1];strcpy(lesson,1);}void Print() const{Staff::Print();coutLesson:lessonendl;}protected:char* lesson。程序設(shè)計(jì)如下:includeincludedefine N 8float grades[N];//存放成績的數(shù)組int main(){int i;float total,average;//提示輸入成績for(i=0;iN;i++){coutEnter grade(i+1):;cingrades[i];}total=0;for(i=0;iN;i++)total+=grades[i];average=total/N;cout\nAverage grade:averageendl;}習(xí)題10參考答案一、 選擇題1.D 2.A 3. A 4.A 5.①A ②B ③D二、填空題1.公有繼承(public),私有繼承(private),保護(hù)繼承(protected)2.對象,層次3.私有繼承(private)4.派生,基5.基類的構(gòu)造函數(shù),子對象的構(gòu)造函數(shù),派生類本身的構(gòu)造函數(shù)三、編程題大學(xué)里有這樣幾類人員:學(xué)生、教師、職員和兼職教書的教師。z39。amp。A39。z39。amp。a39。paveend1;}習(xí)題9參考答案一、 選擇題1.A 2.D 3.A 4.A 5.A二、填空題1.對象數(shù)組2.該指針指向一個(gè)數(shù)組3.該數(shù)組中每個(gè)元素都是一個(gè)指針對象4.子對象5.堆對象三、編程題1.編寫一個(gè)函數(shù),統(tǒng)計(jì)一條英文句子中字母的個(gè)數(shù),在
點(diǎn)擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1