欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

团体程序设计天梯赛-练习集 L1-063 吃鱼还是吃肉 (10分)

程序员文章站 2024-02-27 12:32:27
...

团体程序设计天梯赛-练习集 L1-063 吃鱼还是吃肉 (10分)

#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;
        }
    }
}