이 튜토리얼에서는 문자가 모음인지 자음인지 알아보는 프로그램에 대해 설명합니다.
이를 위해 캐릭터가 제공됩니다. 우리의 임무는 제공된 문자가 모음인지 자음인지를 사용자에게 출력하는 것입니다.
예시
#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