欢迎来到天天文库
浏览记录
ID:16292114
大小:45.50 KB
页数:16页
时间:2018-08-09
《程序阅读和设计题》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、第1章程序阅读和设计题:阅读程序,给出运行结果:(1)#include"iostream.h"intm=10;voida(intn){n=15/n;m=m/2;}voidmain(){intn=3;a(n);cout<<"m="<2、.0,7.0};cout<3、4、[0];f(p,2);for(i=0;i<5;i++)cout<5、t<<"con1called.";}A(intm){a=b=m;cout<<"con2called.";}A(intm,intn){a=m;b=n;cout<<"con3called.";}voidprint(){cout<<"a="<6、:intx;staticinty;public:point(intpx=10){x=px;y++;}staticintgetpx(pointa){return(a.x);}staticintgetpy(pointb){return(b.y);}voidsetx(intc){x=c;}};intpoint::y=0;voidmain(){pointp[5];for(inti=0;i<5;i++)p[i].setx(i);for(i=0;i<5;i++){cout<7、<'t';cout<putx()<#i8、ncludeclassA{char*a;public:A(char*s){a=newchar[strlen(s)+1];strcpy(a,s);cout<classA{in
2、.0,7.0};cout<3、4、[0];f(p,2);for(i=0;i<5;i++)cout<5、t<<"con1called.";}A(intm){a=b=m;cout<<"con2called.";}A(intm,intn){a=m;b=n;cout<<"con3called.";}voidprint(){cout<<"a="<6、:intx;staticinty;public:point(intpx=10){x=px;y++;}staticintgetpx(pointa){return(a.x);}staticintgetpy(pointb){return(b.y);}voidsetx(intc){x=c;}};intpoint::y=0;voidmain(){pointp[5];for(inti=0;i<5;i++)p[i].setx(i);for(i=0;i<5;i++){cout<7、<'t';cout<putx()<#i8、ncludeclassA{char*a;public:A(char*s){a=newchar[strlen(s)+1];strcpy(a,s);cout<classA{in
3、4、[0];f(p,2);for(i=0;i<5;i++)cout<5、t<<"con1called.";}A(intm){a=b=m;cout<<"con2called.";}A(intm,intn){a=m;b=n;cout<<"con3called.";}voidprint(){cout<<"a="<6、:intx;staticinty;public:point(intpx=10){x=px;y++;}staticintgetpx(pointa){return(a.x);}staticintgetpy(pointb){return(b.y);}voidsetx(intc){x=c;}};intpoint::y=0;voidmain(){pointp[5];for(inti=0;i<5;i++)p[i].setx(i);for(i=0;i<5;i++){cout<7、<'t';cout<putx()<#i8、ncludeclassA{char*a;public:A(char*s){a=newchar[strlen(s)+1];strcpy(a,s);cout<classA{in
4、[0];f(p,2);for(i=0;i<5;i++)cout<5、t<<"con1called.";}A(intm){a=b=m;cout<<"con2called.";}A(intm,intn){a=m;b=n;cout<<"con3called.";}voidprint(){cout<<"a="<6、:intx;staticinty;public:point(intpx=10){x=px;y++;}staticintgetpx(pointa){return(a.x);}staticintgetpy(pointb){return(b.y);}voidsetx(intc){x=c;}};intpoint::y=0;voidmain(){pointp[5];for(inti=0;i<5;i++)p[i].setx(i);for(i=0;i<5;i++){cout<7、<'t';cout<putx()<#i8、ncludeclassA{char*a;public:A(char*s){a=newchar[strlen(s)+1];strcpy(a,s);cout<classA{in
5、t<<"con1called.";}A(intm){a=b=m;cout<<"con2called.";}A(intm,intn){a=m;b=n;cout<<"con3called.";}voidprint(){cout<<"a="<6、:intx;staticinty;public:point(intpx=10){x=px;y++;}staticintgetpx(pointa){return(a.x);}staticintgetpy(pointb){return(b.y);}voidsetx(intc){x=c;}};intpoint::y=0;voidmain(){pointp[5];for(inti=0;i<5;i++)p[i].setx(i);for(i=0;i<5;i++){cout<7、<'t';cout<putx()<#i8、ncludeclassA{char*a;public:A(char*s){a=newchar[strlen(s)+1];strcpy(a,s);cout<classA{in
6、:intx;staticinty;public:point(intpx=10){x=px;y++;}staticintgetpx(pointa){return(a.x);}staticintgetpy(pointb){return(b.y);}voidsetx(intc){x=c;}};intpoint::y=0;voidmain(){pointp[5];for(inti=0;i<5;i++)p[i].setx(i);for(i=0;i<5;i++){cout<7、<'t';cout<putx()<#i8、ncludeclassA{char*a;public:A(char*s){a=newchar[strlen(s)+1];strcpy(a,s);cout<classA{in
7、<'t';cout<putx()<#i
8、ncludeclassA{char*a;public:A(char*s){a=newchar[strlen(s)+1];strcpy(a,s);cout<classA{in
此文档下载收益归作者所有