![](https://csdnimg.cn/release/download_crawler_static/87095167/bg4.jpg)
(完整 word 版)c++primerplus(第六版)课后编程练习答案
return 0;
}
//ex3.2--计算相应的 body mass index(体重指数)
#include〈iostream>
const int inch_per_feet=12;
const double meter_per_inch=0.0254;
const double pound_per_kilogram=2.2;
int main()
{
using namespace std;
cout〈<”Please enter your height:"<〈endl;
cout〈〈”First,enter your height of feet part(输入你身高的英尺部分):_\b”;
int ht_feet;
cin>>ht_feet;
cout<<”Second,enter your height of inch part(输入你身高的英寸部分):_\b”;
int ht_inch;
cin>>ht_inch;
cout〈〈"Now,please enter your weight in pound:___\b\b\b";
double wt_pound;
cin>>wt_pound;
int inch;
inch=ht_feet*inch_per_feet+ht_inch;
double ht_meter;
ht_meter=inch*meter_per_inch;
double wt_kilogram;
wt_kilogram=wt_pound/pound_per_kilogram;
cout〈<endl;
cout〈<"Your pensonal body information as follows:"<<endl;
cout<〈"身高:”<<inch<<”(英尺 inch)\n"<<”身高:”〈〈ht_meter〈<”(米 meter)\n"
<<”体重:"<〈wt_kilogram<〈"(千克 kilogram)\n”;
double BMI;
BMI=wt_kilogram/(ht_meter*ht_meter);
cout<〈"your Body Mass Index(体重指数) is "〈〈BMI〈<endl;
return 0;
}
//ex3。3 以度,分,秒输入,以度输出
#include<iostream>
const int minutes_per_degree=60;
const int seconds_per_minute=60;
int main()
{
using namespace std;
cout<〈”Enter a latitude in degrees,minutes,and seconds:\n";
cout〈〈”First,enter the degrees:";
int degree;
cin>>degree;
cout〈〈"Next,enter the minutes of arc:";