在C ++中查找字符是元音还是辅音的程序
为此,我们将被提供一个角色。我们的任务是向用户打印出所提供的字符是元音还是辅音。
示例
#include <iostream>
using namespace std;
//checking if the character is a vowel or consonant
void is_vowel(char x){
if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u')
cout << "Vowel" << endl;
else
cout << "Consonant" << endl;
}
int main(){
is_vowel('c');
is_vowel('e');
return 0;
}输出结果
Consonant Vowel
热门推荐
10 单位春节祝福语简短优美
11 结婚古风祝福语 唯美简短
12 孩子成长祝福语老师简短
13 最美结婚蜜月祝福语简短
14 中考感言简短祝福语大全
15 送别老外祝福语英文简短
16 药材广告祝福语大全简短
17 清晨寄语诗句祝福语简短
18 端午祝福语简短送老师