Count Vowel: In the Mini project 8th module is to find the number of vowel letters in a word(consider both uppercase and lowercase). Rita allotted this function to Patrick.
Help Patrick to write a program to find the number of vowel letters in a word.
Function Specification:
int findNumberOfVowels(char);
Input format :
Input consists of a string.
Output format :
Output consists of an integer saying the number of vowel in the given word.
Refer sample Input and Output for further specifications.
[ All text of bold corresponds to input and the rest corresponds to output. ]
Sample Input and Output format :
Enter the word :
Alice
Count of vowels in Alice is 3
Function Definitions:
| int findNumberOfVowels (char *) |
Solution
#include <iostream>
using namespace std;
int findNumberOfVowels(char *word)
{
int count = 0;
for (int i = 0; word[i] != '\0'; i++)
{
if (word[i] == 'a' || word[i] == 'e' || word[i] == 'i' || word[i] == 'o' || word[i] == 'u' || word[i] == 'A' || word[i] == 'E' || word[i] == 'I' || word[i] == 'O' || word[i] == 'U')
{
count++;
}
}
return count;
}
int main()
{
char word[100];
cout << "Enter the word :\n";
cin >> word;
cout << "Count of vowels in " << word << " is " << findNumberOfVowels(word) << endl;
return 0;
}Happy Learning – If you require any further information, feel free to contact me.
![[Solved] Count Vowel with C++ [Solved] Count Vowel with C++](https://realcoder.techss24.com/wp-content/uploads/2022/07/Solved-Count-Vowel-with-C-1.png)
![[Solved] Write an algorithm to identify which words will be saved in the dictionary](https://realcoder.techss24.com/wp-content/uploads/2023/01/Solved-Write-an-algorithm-to-identify-which-words-will-be-saved-in-the-dictionary-300x200.png)
![[Solved] Minimum At Pop Contest Problem](https://realcoder.techss24.com/wp-content/uploads/2022/09/Solved-Minimum-At-Pop-Contest-Problem-300x200.png)
![[Solved] Match Substring After Replacement LeetCode Contest Problem](https://realcoder.techss24.com/wp-content/uploads/2022/06/Solved-Match-Substring-After-Replacement-LeetCode-Contest-Problem-300x200.png)