How to judge vowels and consonants in C language
The editor of this article introduces in detail "how to judge vowels and consonants in C language". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to judge vowels and consonants in C language" can help you solve your doubts. Let's follow the editor's train of thought to learn new knowledge.
Determine whether the letter entered is a vowel or a consonant.
English has 26 letters, and the vowels include only five letters: a, e, I, o and u, and the rest are consonants. Y is a semi-vowel and semi-consonant, but it is used as a consonant in English.
Example
# include
Int main () {
Char c
Int isLowercaseVowel, isUppercaseVowel
Printf ("enter a letter:")
Scanf (& c)
/ / lowercase vowels
IsLowercaseVowel = (c = ='a' | | c = ='e' | | c = ='i' | | c = ='o' | | c = ='u')
/ / uppercase vowel
IsUppercaseVowel = (c = ='A' | | c = ='E' | | c = ='I' | | c = ='O' | | c = ='U')
/ / if statement judgment
If (isLowercaseVowel | | isUppercaseVowel)
Printf ("% c is a vowel", c)
Else
Printf ("% c is consonant", c)
Return 0
}
Running result:
Enter a letter: GG is a consonant read here, this article "C language how to judge vowels and consonants" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.