團體程序設計天梯賽-練習集 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;
        }
    }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章