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

Cprimerplus编程练习答案

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

int cun;

cout<<\请输入英寸单位的身高(整数):_______\\b\\b\\b\\b\\b\\b\ cin>>cun; iswap(cun); }

2:#include using namespace std; const double yingchi=12; const double bang=; const double memter=;

void caculate(double chi,double cun,double weight) {

double BMI;

double yingcun,mi,qianke; yingcun=cun+chi*yingchi; mi=yingcun*memter; qianke=weight/bang; BMI=qianke/(mi*mi);

cout<<\您的BMI值为: \ }

void main() {

double chi,cun,weight;

cout<<\请输入身高(以几英尺几英寸方式输入): \ cin>>chi>>cun;

cout<<\请输入体重(以磅为单位): \ cin>>weight;

caculate(chi,cun,weight); }

3:#include using namespace std; void main() {

double degrees,minutes,seconds,sum;

cout<<\seconds:\

cout<<\ cin>>degrees;

cout<<\ cin>>minutes;

cout<<\ cin>>seconds;

sum=degrees+minutes/60+seconds/3600;

cout<

minutes,\ }

4:#include using namespace std; const long m=60; const long h=60; const long d=24; int sumday(long seconds) {

long hour,minute; minute=seconds/m; hour=minute/h; return hour/d; }

int sumhour(long seconds,int day) {

long minute;

seconds=seconds-day*d*h*m; minute=seconds/m; return minute/h; }

int summinute(long seconds,int day,int hour) {

seconds=seconds-(day*d*h*m+hour*h*m); return seconds/m; }

int sumsecond(long seconds,int day,int hour,int minute) {

return seconds=seconds-(day*d*h*m+hour*h*m+minute*m); }

void main() {

long seconds;

int day,hour,minute,second;

cout<<\ cin>>seconds; day=sumday(seconds); hour=sumhour(seconds,day);

minute=summinute(seconds,day,hour); second=sumsecond(seconds,day,hour,minute);

cout<

5:#include using namespace std; void main() {

double world,us;

cout<<\ cin>>world;

cout<<\ cin>>us; double bilv; bilv=us/world;

cout<<\population.\ }

6:#include using namespace std; void main() {

float memter,jialun;

cout<<\以美国风格还是欧洲风格显示耗油量m为美国,o为欧洲!\

cout<<\请输入(m或o):\

Cprimerplus编程练习答案

intcun;cout<>cun;iswap(cun);}2:#includeusingnamespacestd;constdoubleyingchi=12;constdoublebang=;constdoub
推荐度:
点击下载文档文档为doc格式
2nie743ddd02ra61x73m28mwx147wg01cvu
领取福利

微信扫码领取福利

微信扫码分享