团体程序设计天梯赛-练习集 L1-063 吃鱼还是吃肉 (10分)
程序员文章站
2024-02-27 12:32:27
...
#include <iostream>
using namespace std;
void print(int sex, int height, int weight);
int main()
{
int num, sex, height, weight;
cin >> num;
while (num--)
{
cin >> sex >> height >> weight;
print(sex, height, weight);
}
return 0;
}
void print(int sex, int height, int weight)
{
if (sex == 1)
{
if (height > 130)
{
cout << "ni li hai! ";
}
else if (height == 130)
{
cout << "wan mei! ";
}
else
{
cout << "duo chi yu! ";
}
if (weight > 27)
{
cout << "shao chi rou!" << endl;
}
else if (weight == 27)
{
cout << "wan mei!" << endl;
}
else
{
cout << "duo chi rou!" << endl;
}
}
else
{
if (height > 129)
{
cout << "ni li hai! ";
}
else if (height == 129)
{
cout << "wan mei! ";
}
else
{
cout << "duo chi yu! ";
}
if (weight > 25)
{
cout << "shao chi rou!" << endl;
}
else if (weight == 25)
{
cout << "wan mei!" << endl;
}
else
{
cout << "duo chi rou!" << endl;
}
}
}
上一篇: 关于递归的简单理解