markdown 检查元音或辅音

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 检查元音或辅音相关的知识,希望对你有一定的参考价值。

#include <iostream>

int main()
{
    char c;
    int isLowercaseVowel, isUppercaseVowel;

    std::cout << "Enter a letter in the alphabet (a - z): ";
    std::cin >> c;

    // evaluates to 1 (true) if c is a lowercase vowel
    isLowercaseVowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');

    // evaluates to 1 (true) if c is an uppercase vowel
    isUppercaseVowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');

    // evaluates to 1 (true) if either isLowercaseVowel or isUppercaseVowel is true
    if (isLowercaseVowel || isUppercaseVowel)
        std::cout << "'" << c << "' is a vowel.";
    else
        std::cout << "'" << c << "' is a consonant.";

    return 0;
}
- Using an if...else statement to check whether an alphabet entered by the user is a vowel or a constant.
- Five alphabets a, e, i, o and u are known as vowels. All other alphabets except these 5 alphabets are known are consonants.
- This program assumes that the user will always enter an alphabet.
- - -
The `isLowerCaseVowel` evaluates to true if user input is a `lower case vowel` and false for any other character.

Similarly, isUpperCaseVowel evaluates to true if user input is a `upper case vowel` and false for any other character.

If both `isLowercaseVowel` and `isUppercaseVowel` is true, the character entered is a vowel , if not the character is a consonant.

以上是关于markdown 检查元音或辅音的主要内容,如果未能解决你的问题,请参考以下文章

csharp 返回字符串中元音或辅音的数量。

通过相等数量的元音和辅音进行正则表达式验证[关闭]

csharp 使用else if语句查找字符是否为元音或辅音的示例。

csharp 使用else if语句查找字符是否为元音或辅音的示例。

20180524模拟赛T3——Word

德语发音教程:元音和辅音