//3.1
#include
const char c=10;
int main31()
{
using namespace std;
cout<<”please enter your level”<<c<<endl;
int l;
cin>>l;
cout<<”your level is”<<l*c<<endl;
cin.get();
cin.get();
return 0;
}
3.2
//3.2
#include <iostream.h>
#include <math.h>
const int CToC=12; //1英尺=12英寸
const double KToB=2.2;//1KG=2.2磅
const float CToM=0.0254;//1英尺=0.0254m
int main()
{
cout<<”Enter your Level:(英尺)”;
int yc;
cin>>yc;
cout<<”Enter your level:(英寸)”;
int yci;
cin>>yci;
cout<<”\nNow Enter your Weight:”<<endl;
double w;
cin>>w;
int l=yc*CToC+yci;
float li=l*CToM;
double wi=w*KToB;
double bmi=wi/sqrt(li);
cout<<”BMI=”<<bmi;
cin.get();
cin.get();
return 0;
}
3.3
//3.3
#include <iostream.h>
const int DToM=60;
const int MToS=60;
int main()
{
cout<<”Enter a latitude in degrees,Minute,an seconds:”<<endl;
cout<<”First,enter the degreess:”;
int d;
cin>>d;
cout<<”\nNext,enter the minutes of arc:”;
int m;
cin>>m;
cout<<”\nFinally,enter the seconds of arc:”;
int s;
cin>>s;
cout<<d<<” degreess ,”<<m<<” minutes, “<<s<<” seconds”
<<”=”<<float(m/DToM+s/MToS/DToM+d)<<”degress”<<endl;
cin.get();
cin.get();
return 0;
}
3.4-3.7懒得找了,这一章就发这两道算了
—————————————————————————————————————————————————— //写的错误或者不好的地方请多多指导,可以在下面留言或者给我发邮件,指出我的错误以及不足,以便我修改,更好的分享给大家,谢谢。 转载请注明出处:https://www.royalchen.com/ author:royalchen Email:royalchen@royalchen.com ———————————————————————————————————————————————————
- 本文作者: royalchen
- 本文链接: http://www.royalchen.com/2016/02/24/cprimerplus第六版课后编程题答案3137/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!