Run ID:141530

提交时间:2025-12-26 20:03:52

#include <iostream> using namespace std; double calculateStandardWeight(double height) { return (height - 100) * 0.9; } string evaluateBodyShape(double height, double weight) { double stdWeight = calculateStandardWeight(height); if (weight > stdWeight * 1.1) { return "肥胖"; } else if (weight < stdWeight * 0.9) { return "瘦"; } else { return "标准"; } } int main() { double height, weight; cout << "请输入您的身高(厘米):"; cin >> height; cout << "请输入您的体重(千克):"; cin >> weight; if (height <= 0 || weight <= 0) { cout << "输入数据必须大于0,请重新输入。" << endl; return 1; } string result = evaluateBodyShape(height, weight); cout << "\n根据标准体重计算,您的身材状态是: " << result << endl; return 0; }