欢迎来到天天文库
浏览记录
ID:21058035
大小:358.50 KB
页数:131页
时间:2018-10-19
《《c++程序设计》谭浩强课后习题答案解析》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、word资料下载可编辑第一章1.5题#includeusingnamespacestd;intmain(){cout<<"This"<<"is";cout<<"a"<<"C++";cout<<"program.";return0;1.6题#includeusingnamespacestd;intmain(){inta,b,c;a=10;b=23;c=a+b;cout<<"a+b=";cout<2、iostream>usingnamespacestd;intmain(){inta,b,c;intf(intx,inty,intz);cin>>a>>b>>c;c=f(a,b,c);cout<usingnamespacestd;intmain(){inta,b,3、c;cin>>a>>b;c=a+b;cout<<"a+b="<usingnamespacestd;intmain(){inta,b,c;intadd(intx,inty);cin>>a>>b;c=add(a,b);cout<<"a+b="<usingnamespac4、estd;intmain(){charc1='a',c2='b',c3='c',c4='101',c5='116';cout<usingnamespacestd;intmain(){charc1='C',c2='+',c3='+';专业技术资料word资料下载可编辑cout<<"Isay:""<5、<<"tt"<<"Hesays:"C++isveryinteresting!""<<'';return0;}2.7题#includeusingnamespacestd;intmain(){inti,j,m,n;i=8;j=10;m=++i+j++;n=(++i)+(++j)+m;cout<usingnamespacestd;intmain()6、{charc1='C',c2='h',c3='i',c4='n',c5='a';c1+=4;c2+=4;c3+=4;c4+=4;c5+=4;cout<<"passwordis:"<#includeusingnamespacestd;intmain(){floath,r,l,s,sq,vq,vz;constfloatpi=3.1415926;cout<<"pleaseenter7、r,h:";cin>>r>>h;l=2*pi*r;s=r*r*pi;sq=4*pi*r*r;vq=3.0/4.0*pi*r*r*r;vz=pi*r*r*h;cout<8、ndl;cout<<"vq="<usingnamespacestd;intmain(){floatc,f;cout<<"请输入一个华氏温度:";cin>>f;c=(5.0/9.0)*(f-32);//注意5和9要用实型表示,否则5/9值为0cout<<"摄氏温度为
2、iostream>usingnamespacestd;intmain(){inta,b,c;intf(intx,inty,intz);cin>>a>>b>>c;c=f(a,b,c);cout<usingnamespacestd;intmain(){inta,b,
3、c;cin>>a>>b;c=a+b;cout<<"a+b="<usingnamespacestd;intmain(){inta,b,c;intadd(intx,inty);cin>>a>>b;c=add(a,b);cout<<"a+b="<usingnamespac
4、estd;intmain(){charc1='a',c2='b',c3='c',c4='101',c5='116';cout<usingnamespacestd;intmain(){charc1='C',c2='+',c3='+';专业技术资料word资料下载可编辑cout<<"Isay:""<5、<<"tt"<<"Hesays:"C++isveryinteresting!""<<'';return0;}2.7题#includeusingnamespacestd;intmain(){inti,j,m,n;i=8;j=10;m=++i+j++;n=(++i)+(++j)+m;cout<usingnamespacestd;intmain()6、{charc1='C',c2='h',c3='i',c4='n',c5='a';c1+=4;c2+=4;c3+=4;c4+=4;c5+=4;cout<<"passwordis:"<#includeusingnamespacestd;intmain(){floath,r,l,s,sq,vq,vz;constfloatpi=3.1415926;cout<<"pleaseenter7、r,h:";cin>>r>>h;l=2*pi*r;s=r*r*pi;sq=4*pi*r*r;vq=3.0/4.0*pi*r*r*r;vz=pi*r*r*h;cout<8、ndl;cout<<"vq="<usingnamespacestd;intmain(){floatc,f;cout<<"请输入一个华氏温度:";cin>>f;c=(5.0/9.0)*(f-32);//注意5和9要用实型表示,否则5/9值为0cout<<"摄氏温度为
5、<<"tt"<<"Hesays:"C++isveryinteresting!""<<'';return0;}2.7题#includeusingnamespacestd;intmain(){inti,j,m,n;i=8;j=10;m=++i+j++;n=(++i)+(++j)+m;cout<usingnamespacestd;intmain()
6、{charc1='C',c2='h',c3='i',c4='n',c5='a';c1+=4;c2+=4;c3+=4;c4+=4;c5+=4;cout<<"passwordis:"<#includeusingnamespacestd;intmain(){floath,r,l,s,sq,vq,vz;constfloatpi=3.1415926;cout<<"pleaseenter
7、r,h:";cin>>r>>h;l=2*pi*r;s=r*r*pi;sq=4*pi*r*r;vq=3.0/4.0*pi*r*r*r;vz=pi*r*r*h;cout<8、ndl;cout<<"vq="<usingnamespacestd;intmain(){floatc,f;cout<<"请输入一个华氏温度:";cin>>f;c=(5.0/9.0)*(f-32);//注意5和9要用实型表示,否则5/9值为0cout<<"摄氏温度为
8、ndl;cout<<"vq="<usingnamespacestd;intmain(){floatc,f;cout<<"请输入一个华氏温度:";cin>>f;c=(5.0/9.0)*(f-32);//注意5和9要用实型表示,否则5/9值为0cout<<"摄氏温度为
此文档下载收益归作者所有