c++写程序:据说一个人的标准体重应该是其身高单位:厘米减去100、再乘以09所得到的公斤数。真实体重与标准体重误差在10以内都是完美身材即 真实体重 − 标准体重 标准体重×10。已知市斤是公斤的两倍。现给定一群人的身高和实际体重请你告诉他们是否太胖或太瘦了。输入格式:输入第一行给出一个正整数N≤ 20。随后N行每行给出两个整数分别是一个人的身高H120 H 200;单位:厘米和真实体
#include
int main() { int N; cin >> N;
for (int i = 0; i < N; i++) {
int H, W;
cin >> H >> W;
double standard = (H - 100) * 0.9;
double difference = W - standard;
double threshold = standard * 0.1;
if (difference < -threshold) {
cout << "You are tai shou le!" << endl;
} else if (difference > threshold) {
cout << "You are tai pang le!" << endl;
} else {
cout << "You are wan mei!" << endl;
}
}
return 0;
原文地址: https://www.cveoy.top/t/topic/hQsF 著作权归作者所有。请勿转载和采集!