标签:space out aar oat string turn ret ons 输入
//体重指数程序
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
const int BMI_CONSTANT = 703;
float weight;
float height;
float bodyMassIndex;
bool dadtaAreOk;
cout << "。。。的士速递发的" << endl;
cout << "输入体重(千克) " << endl;
cin >> weight;
weight = weight / 0.4535924;
cout << "输入升高(厘米) " << endl;
cin >> height;
height = height / 2.54;
if (weight < 0 || height < 0)
dadtaAreOk = false;
else
dadtaAreOk = true;
if (dadtaAreOk)
{
bodyMassIndex = weight * BMI_CONSTANT / (height * height);
cout << "your body indedx is " << bodyMassIndex
<< "." << endl;
cout << "interpretation ans instructiobn:" << endl;
if (bodyMassIndex < 20)
cout << "体重不不足,喝杯奶昔" << endl;
else if (bodyMassIndex <= 25)
cout << "正常,喝杯牛奶" << endl;
else if (bodyMassIndex <= 30)
cout << "超重,喝杯冰茶" << endl;
else
cout << "超重,看医生吧" << endl;
}
else
cout << "数据有问题" << endl;
cin.get();
cin.get();
return 0;
}
标签:space out aar oat string turn ret ons 输入
原文地址:http://www.cnblogs.com/skylover/p/7040931.html