cprimerplus第六版课后编程练习答案

2026/4/27 16:44:49

intmain()

{

usingnamespacestd;

cout<<\

doubleC;

cin>>C;

doubleF;

F=C2F(C);

cout<

return0;

}

doubleC2F(doublet)

{

return1.8*t+32;

}

//ex2.6---convertthelightyearsvalvetoastronomicalunits--把光年转换为天文单位

#include

doubleconvert(double);//函数原型

intmain()

{

usingnamespacestd;

cout<<\

doublelight_years;

cin>>light_years;

doubleastro_units;

astro_units=convert(light_years);

cout<

return0;

}

doubleconvert(doublet)

{

return63240*t;//1光年=63240天文单位

}

//ex2.7--显示用户输入的小时数和分钟数

#include

voidshow();

main()

{

usingnamespacestd;

show();

return0;

}

voidshow()

{

usingnamespacestd;

inth,m;

cout<<\

cin>>h;

cout<<\

cin>>m;

cout<<\

}

第三章:处理数据

//ex3.1—将身高用英尺(feet)和英寸(inch)表示

#include

constintinch_per_feet=12;//const常量--1feet=12inches--1英尺=12英寸

intmain()

{

usingnamespacestd;

cout<<\表示为退格字符

intht_inch;

cin>>ht_inch;

intht_feet=ht_inch/inch_per_feet;//取商

intrm_inch=ht_inch%inch_per_feet;//取余


cprimerplus第六版课后编程练习答案.doc 将本文的Word文档下载到电脑
搜索更多关于: cprimerplus第六版课后编程练习答案 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219