C++入门同步记录#6

#include<iostream>
using namespace std;
int main() {
    int x;
    cin >> x;
    cout << "Today, I ate " << x << " apple";
    if (x > 1) {
    // if (x != 0 && x != 1){
        cout << "s" << endl;
    }
    return 0;
}


#include<iostream>
using namespace std;
int main () {
    int x;
    cin >> x;
    if ((11 + 3 * x) > (5 * x)) cout << "Local" << endl; else cout << "Luogu" << endl;
    return 0;
}


#include<iostream>
using namespace std;
int main () {
    char opt;
    cin >> opt;
    switch (opt) {
        case 'G': cout << "Hello, my master!" << endl;
        case 'N': cout << "I'm Xiaoluo." << endl; break;
        case 'S': cout << "Teinei teinei teinei~" << endl; break;  
        case 'B': case 'Q': cout << "Bye bye!" << endl; break;
        default: cout << "Sorry.." << endl;
    }
    return 0;
}



#include<iostream>
using namespace std;
int main() {
    double m, h, BMI;
    cin >> m >> h;
    BMI = m / h / h;
    if (BMI < 18.5)
        cout << "Underweight";
    else if (BMI < 24)
        cout << "Normal";
    else {
        cout << BMI << endl;
        cout << "Overweight" << endl;
    }
    return 0;
}



#include<iostream>
using namespace std;
int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a <= b && b <= c) printf("%d %d %d\n", a, b, c);
    else if (a <= c && c <= b) printf("%d %d %d\n", a, c, b);
    else if (b <= a && a <= c) printf("%d %d %d\n", b, a, c);
    else if (b <= c && c <= a) printf("%d %d %d\n", b, c, a);
    else if (c <= a && a <= b) printf("%d %d %d\n", c, a, b);
    else printf("%d %d %d\n", c, b, a);
    return 0;
}



#include<iostream>
using namespace std;
int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a >= b && a >= c) {
        if (b >= c) printf("%d %d %d", c, b, a);
        else printf("%d %d %d", b, c, a);
    }
    else if (b >= a && b >= c) {
        if (a >= c) printf("%d %d %d", c, a, b);
        else printf("%d %d %d", a, c, b);
    }
    else if (c >= b && c >= a) {
        if (a >= b) printf("%d %d %d", b, a, c);
        else printf("%d %d %d", a, b, c);
    }
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值