けんちょんの競プロ精進記録

競プロの精進記録や小ネタを書いていきます

AtCoder ABC 049 A - 居合を終え、青い絵を覆う (灰色, 100 点)

if 文を使う!

問題概要

英小文字  c が与えられる。 c が母音かどうかを判定せよ。

解法

 c が 'a', 'i', 'u', 'e', 'o' のいずれかであるかを if 文を用いて判定する。

#include <bits/stdc++.h>
using namespace std;

int main() {
    char c;
    cin >> c;
    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
        cout << "vowel" << endl;
    else
        cout << "consonant" << endl;
}