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

发布时间 : 星期二 文章cprimerplus第六版课后编程练习答案更新完毕开始阅读

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;//取余

联系合同范文客服:xxxxx#qq.com(#替换为@)