- 1、本文档共90页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
c钱能第一版课后习题答案
(二)
2.1
#includeiostream.h
voidmain()
{ //本题原考虑在16位机器上实验目前多为32位机器,故已过时。
inta=42486;
coutoctaendl
he aendl;
unsignedb=42486;
coutdec(signed)bendl;
}
2.2
#includeiostream.h
#includeiomanip.h
constdoublepi=3.1415926;
voidmain()
{
doubleradius1,radius2;
coutpleaseinputtwonumbers:\n;
cinradius1radius2;
coutsetw(10)pisetw(10)radius1
setw(10)(pi*radius1*radius1)endl
setw(10)pisetw(10)radius2
setw(10)(pi*radius2*radius2)endl;
}
2.3
#includeiostream.h
#includeiomanip.h
constdoublee=2.718281828;
voidmain()
{
coutsetprecision(10)eendl
setiosflags(ios::fixed)setprecision(8)eendl
setiosflags(ios::scientific)eendl;
}
2.4
#includeiostream.h
voidmain()
{
cout\Howmanystudentshere?\\n
\500\\n;
}
2.5
#includeiostream.h
voidmain()
{
coutsizeofchar sizeof(char)byte\n
sizeofunsignedchar sizeof(unsignedchar)byte\n
sizeofsignedchar sizeof(signedchar)byte\n
sizeofint sizeof(int)byte\n
sizeofunsigned sizeof(unsigned)byte\n
sizeofsigned sizeof(signed)byte\n
sizeofshort sizeof(short)byte\n
sizeofunsignedshortsizeof(unsignedshort)byte\n
sizeoflong sizeof(long)byte\n
sizeofsignedlong sizeof(signedlong)byte\n
sizeofunsignedlong sizeof(unsignedlong)byte\n
sizeoffloat sizeof(float)byte\n
sizeofdouble sizeof(double)byte\n
sizeoflongdouble sizeof(longdouble)byte\n;
}
2.6
1)
pleaseinput3sidesofonetriangle:
6,6,8
a= 6.00,b= 6.00,c= 8.00
areaoftriangleis 17.88854
2)
该程序计算三角形的面积
前后分为三部分:输入,处理,输出。
3)
//#includestdio.h
#includeiostream.h
#includeiomanip.h
#includemath.h
voidmain()
{
floata,b,c,s,area;
//printf(pleaseinpu
文档评论(0)