欢迎来到天天文库
浏览记录
ID:61931790
大小:403.50 KB
页数:24页
时间:2021-03-31
《C++第六次作业复习课程.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、__________________________________________________一、【3.14】1、题目:以下程序的运行结果是(B.7,8)#includeusingnamespacestd;classB{public:B(){}B(inti,intj){x=i;y=j;}voidprintb(){cout<2、____________________________________________________________A(intI,intj);voidprinta();private:Bc;};A::A(inti,intj):c(i,j){}voidA::printa(){c.printb();}intmain(){Aa(7,8);a.printa();return0;}1、运行结果:【3.15】1、题目:以下程序的运行结果是(A.24)#includeusingnamespacestd;classA{pub3、lic:voidset(inti,intj){x=i;y=j;}intget_y(){returny;}____________________________________________________________________________________________________private:intx,y;};classbox{public:voidset(intl,intw,ints,intp){length=l;width=w;label.set(s,p);}intget_area(){returnle4、ngth*width;}private:intlength,width;Alabel;};intmain(){boxb;b.set(4,6,1,20);cout<usingnamespacestd;classSample{public:Sample(inti,intj){x=i;y=j;}________________________________________5、____________________________________________________________voiddisp(){cout<<"displ"<usingnamespacestd;clas6、sR{public:R(intr1,intr2){R1=r1;R2=r2;}voidprint();voidprint()const;private:intR1,R2;};voidR::print(){cout<7、;}intmain(){Ra(6,8);constRb(56,88);b.print();return0;}2、运行结果。【3.18】1、题目:写出下面程序的运行结果。#includeusingnamespacestd;classtoy{public:toy(intq,intp){quan=q;price=p;}intget_quan(){returnquan;}intget_price(){returnprice;}private:intquan,price;};intmain(){toyop[3][2]={t8、oy(10,20),toy(30,48),toy(50,68),toy(70,80),toy(90,16),toy(11,120),___________________________________________________
2、____________________________________________________________A(intI,intj);voidprinta();private:Bc;};A::A(inti,intj):c(i,j){}voidA::printa(){c.printb();}intmain(){Aa(7,8);a.printa();return0;}1、运行结果:【3.15】1、题目:以下程序的运行结果是(A.24)#includeusingnamespacestd;classA{pub
3、lic:voidset(inti,intj){x=i;y=j;}intget_y(){returny;}____________________________________________________________________________________________________private:intx,y;};classbox{public:voidset(intl,intw,ints,intp){length=l;width=w;label.set(s,p);}intget_area(){returnle
4、ngth*width;}private:intlength,width;Alabel;};intmain(){boxb;b.set(4,6,1,20);cout<usingnamespacestd;classSample{public:Sample(inti,intj){x=i;y=j;}________________________________________
5、____________________________________________________________voiddisp(){cout<<"displ"<usingnamespacestd;clas
6、sR{public:R(intr1,intr2){R1=r1;R2=r2;}voidprint();voidprint()const;private:intR1,R2;};voidR::print(){cout<7、;}intmain(){Ra(6,8);constRb(56,88);b.print();return0;}2、运行结果。【3.18】1、题目:写出下面程序的运行结果。#includeusingnamespacestd;classtoy{public:toy(intq,intp){quan=q;price=p;}intget_quan(){returnquan;}intget_price(){returnprice;}private:intquan,price;};intmain(){toyop[3][2]={t8、oy(10,20),toy(30,48),toy(50,68),toy(70,80),toy(90,16),toy(11,120),___________________________________________________
7、;}intmain(){Ra(6,8);constRb(56,88);b.print();return0;}2、运行结果。【3.18】1、题目:写出下面程序的运行结果。#includeusingnamespacestd;classtoy{public:toy(intq,intp){quan=q;price=p;}intget_quan(){returnquan;}intget_price(){returnprice;}private:intquan,price;};intmain(){toyop[3][2]={t
8、oy(10,20),toy(30,48),toy(50,68),toy(70,80),toy(90,16),toy(11,120),___________________________________________________
此文档下载收益归作者所有