c++ 判断是元音还是辅音

 

#include <iostream>
using namespace std;
 
int main()
{
    char c;
    int isLowercaseVowel, isUppercaseVowel;
 
    cout << "输入一个字母: ";
    cin >> c;
 
    // 小写字母元音
    isLowercaseVowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
 
    // 大写字母元音
    isUppercaseVowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
 
    // if 语句判断
    if (isLowercaseVowel || isUppercaseVowel)
        cout << c << " 是元音";
    else
        cout << c << " 是辅音";
 
    return 0;
}

 

原文链接: https://www.cnblogs.com/sea-stream/p/10977653.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    c++ 判断是元音还是辅音

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/296246

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月15日 下午5:42
下一篇 2023年2月15日 下午5:42

相关推荐