好文档 - 专业文书写作范文服务资料分享网站

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

天下 分享 时间: 加入收藏 我要投稿 点赞

doubleBMI;

BMI=wt_kilogram/(ht_meter*ht_meter);

cout<<\体重指数)is\

return0;

}

//ex3.3以度,分,秒输入,以度输出

#include

constintminutes_per_degree=60;

constintseconds_per_minute=60;

intmain()

{

usingnamespacestd;

cout<<\

cout<<\

intdegree;

cin>>degree;

cout<<\

intminute;

cin>>minute;

cout<<\

intsecond;

cin>>second;

doubleshow_in_degree;

show_in_degree=(double)degree+(double)minute/minutes_per_degree+(double)se

cond/minutes_per_degree/seconds_per_minute;

cout<

degree<<\

return0;

}

//ex3.4

#include

constinthours_per_day=24;

constintminutes_per_hour=60;

constintseconds_per_minute=60;

intmain()

{

usingnamespacestd;

cout<<\

longseconds;

cin>>seconds;

intDay,Hour,Minute,Second;

Day=seconds/seconds_per_minute/minutes_per_hour/hours_per_day;

Hour=seconds/seconds_per_minute/minutes_per_hour%hours_per_day;

Minute=seconds/seconds_per_minute%minutes_per_hour;

Second=seconds%seconds_per_minute;

cout<

\

return0;

}

//ex3.5

#include

intmain()

{

usingnamespacestd;

cout<<\

longlongworld_population;

cin>>world_population;

cout<<\

longlongUS_population;

cin>>US_population;

doublepercentage;

percentage=(double)US_population/world_population*100;

cout<<\

return0;

}

//ex3.6?汽车耗油量-美国(mpg)or欧洲风格(L/100Km)

#include

intmain()

{

?usingnamespacestd;

?cout<<\

?doublem_distance;

?cin>>m_distance;

?cout<<\

?doublem_gasoline;

?cin>>m_gasoline;

?cout<<\

?cout<<\

?cout<<\

?doublek_distance;

?cin>>k_distance;

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

doubleBMI;BMI=wt_kilogram/(ht_meter*ht_meter);cout<<\体重指数)is\return0;}//ex3.3以度,分,秒输入,以度输出#includeconstintminutes_per_degree=60
推荐度:
点击下载文档文档为doc格式
88oza90hm17e16g2f5026bod04q32p00ozi
领取福利

微信扫码领取福利

微信扫码分享