欢迎来到天天文库
浏览记录
ID:27330488
大小:268.00 KB
页数:57页
时间:2018-12-02
《c++面向对象程序设计课后习题答案解析(谭浩强版)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、完美WORD格式第一章5:#includeusingnamespacestd;intmain(){cout<<"This"<<"is";cout<<"a"<<"C++";cout<<"program."<usingnamespacestd;intmain(){inta,b,c;a=10;b=23;c=a+b;cout<<"a+b=";cout<usingnamespacestd;intmain(){inta,
2、b,c;intf(intx,inty,intz);cin>>a>>b>>c;c=f(a,b,c);cout<usingnamespacestd;intmain(){inta,b,c;cin>>a>>b;c=a+b;cout<<"a+b="<usingnamespac
3、estd;intmain(){intadd(intx,inty);inta,b,c;cin>>a>>b;c=add(a,b);cout<<"a+b="<usingnamespacestd;intmain(){voidsort(intx,inty,intz);intx,y,z;cin>>x>>y>>z;专业整理知识分享完美WORD格式sort(x,y,z);return0;}voidsort(intx,inty,intz){in
4、ttemp;if(x>y){temp=x;x=y;y=temp;}//{}内3个语句的作用是将x和y的值互换)if(zusingnamespacestd;intmain(){intmax(inta,intb,intc=0);inta,b,c;cin>>a>>b>>c;cout<<"max(a,b,c)="<5、)<a)a=b;if(c>a)a=c;returna;}12:#includeusingnamespacestd;intmain(){voidchange(int,int);inta,b;cin>>a>>b;if(a6、r2,temp;temp=r1;r1=r2;r2=temp;}13:#includeusingnamespacestd;intmain(){voidsort(int&,int&,int&);inta,b,c,a1,b1,c1;cout<<"Pleaseenter3integers:";cin>>a>>b>>c;a1=a;b1=b;c1=c;sort(a1,b1,c1);cout<7、t&j,int&k){voidchange(int&,int&);if(i>j)change(i,j);if(i>k)change(i,k);if(j>k)change(j,k);}voidchange(int&x,int&y){inttemp;temp=x;x=y;y=temp;}14:#include#includeusingnamespacestd;intmain(){strings1="week",s2="end";cout
5、)<a)a=b;if(c>a)a=c;returna;}12:#includeusingnamespacestd;intmain(){voidchange(int,int);inta,b;cin>>a>>b;if(a6、r2,temp;temp=r1;r1=r2;r2=temp;}13:#includeusingnamespacestd;intmain(){voidsort(int&,int&,int&);inta,b,c,a1,b1,c1;cout<<"Pleaseenter3integers:";cin>>a>>b>>c;a1=a;b1=b;c1=c;sort(a1,b1,c1);cout<7、t&j,int&k){voidchange(int&,int&);if(i>j)change(i,j);if(i>k)change(i,k);if(j>k)change(j,k);}voidchange(int&x,int&y){inttemp;temp=x;x=y;y=temp;}14:#include#includeusingnamespacestd;intmain(){strings1="week",s2="end";cout
6、r2,temp;temp=r1;r1=r2;r2=temp;}13:#includeusingnamespacestd;intmain(){voidsort(int&,int&,int&);inta,b,c,a1,b1,c1;cout<<"Pleaseenter3integers:";cin>>a>>b>>c;a1=a;b1=b;c1=c;sort(a1,b1,c1);cout<7、t&j,int&k){voidchange(int&,int&);if(i>j)change(i,j);if(i>k)change(i,k);if(j>k)change(j,k);}voidchange(int&x,int&y){inttemp;temp=x;x=y;y=temp;}14:#include#includeusingnamespacestd;intmain(){strings1="week",s2="end";cout
7、t&j,int&k){voidchange(int&,int&);if(i>j)change(i,j);if(i>k)change(i,k);if(j>k)change(j,k);}voidchange(int&x,int&y){inttemp;temp=x;x=y;y=temp;}14:#include#includeusingnamespacestd;intmain(){strings1="week",s2="end";cout
此文档下载收益归作者所有