#include"BMI.h"
BMII::BMII(const char* n, float h, float w) {
cout << "BMI system prepared.." << endl;
set(n, h, w);
show();
cal();
cal_hope();
show_zt();
show_do();
}
BMII::~BMII() {
cout << "all delete..." << endl;
}
void BMII::set(const char*n, float h, float w) {//input
strcpy(name, n);
high = h;
weight = w;
}
void BMII::show() {//output
cout << "name:" << name << endl;
cout << "height(m):" << high << endl;
cout << "weight(kg):" << weight << endl;
}
void BMII::cal() {//BMI calculated
BMI = weight / (high*high);
cout << "BMI:" << BMI << endl;
}
void BMII::cal_hope() {//calculate ideal weight
WEI_hope = 22 * (high*high);
cout << "ideal weight:" << WEI_hope << endl;
}
void BMII::show_zt() {//judge
if (BMI < 18.5)cout << "the result:you are too thin" << endl;
else if (BMI >= 18.5 && BMI < 25)cout << "the result:normal" << endl;
else if (BMI >= 25 && BMI < 30)cout << "the result:obesity index 1" << endl;
else if (BMI >= 30 && BMI < 35)cout << "the result:obesity index 2" << endl;
else if (BMI >= 35 && BMI < 40)cout << "the result:obesity index 3" << endl;
else if (BMI >= 40)cout << "the result:obesity index 4" << endl;
}
void BMII::show_do() {
float o = WEI_hope - weight;
if (o > 0)cout <<"conclusion�Fyou should gain"<<' '<< o << "kg" << endl << endl << endl;
else cout<<"conclusion�Fyou should lose"<<' '<<o*(-1)<<"kg" << endl << endl << endl;
}
BMI.rar_BMI_BMI计算_C++_JGY8_enemyg2t
版权申诉
5星 · 超过95%的资源 163 浏览量
2022-09-23
03:26:51
上传
评论
收藏 1KB RAR 举报
刘良运
- 粉丝: 66
- 资源: 1万+
最新资源
- 常用工具配置docker,elasticsearch,minio,nfs,nginx,tippercane,vsftp
- 基于IIC接口E2PROM(AT24C64)芯片FPGA读写VERILOG 设计源码+仿真激励文件.zip
- 基于FPGA深度学习的Block 模块方案实战,适合FPGA初学者
- 20225T9050袁凤(1).py
- Rsa算法详解.docx
- Youren Shang InClassQuiz.ipynb
- code-qat.zip
- usb-serial-for-android
- drools决策表示例Excel文件
- AD5724芯片FPGA Verilog驱动源码+4通道12bit位宽的DAC芯片AD5724技术手册.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈