疫情防控下旅游景点预约系统的设计与实现的国内外研究现状
时间: 2023-11-01 18:07:18 浏览: 37
的体重是否正常的程序。
#include <iostream>
using namespace std;
int main() {
int age;
double height, weight;
char gender;
cout << "请输入您的年龄:";
cin >> age;
cout << "请输入您的身高(米):";
cin >> height;
cout << "请输入您的性别(男:M,女:F):";
cin >> gender;
if (gender == 'M') {
weight = (height - 1.5) * 50 + 50;
} else if (gender == 'F') {
weight = (height - 1.5) * 45 + 45;
} else {
cout << "输入错误" << endl;
return 0;
}
if (age < 18) {
cout << "您还未成年,无法判断体重是否正常。" << endl;
} else if (age < 35) {
if (weight <= (height - 1.1) * 50) {
cout << "体重偏轻" << endl;
} else if (weight >= (height - 1.1) * 70) {
cout << "体重偏重" << endl;
} else {
cout << "体重正常" << endl;
}
} else if (age < 60) {
if (weight <= (height - 1.1) * 52) {
cout << "体重偏轻" << endl;
} else if (weight >= (height - 1.1) * 75) {
cout << "体重偏重" << endl;
} else {
cout << "体重正常" << endl;
}
} else {
if (weight <= (height - 1.1) * 50) {
cout << "体重偏轻" << endl;
} else if (weight >= (height - 1.1) * 72) {
cout << "体重偏重" << endl;
} else {
cout << "体重正常" << endl;
}
}
return 0;
}