COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
vowel.cpp File Reference
#include <iostream>
#include <string>
Include dependency graph for vowel.cpp:

Go to the source code of this file.

Functions

bool isVowel (char a)
 
int main ()
 

Function Documentation

◆ isVowel()

bool isVowel ( char a)

Definition at line 9 of file vowel.cpp.

9 {
10 string vowels = "A E I O U a e i o u";
11 // string.find(char) will return string::npos if not found
12 // first character is index 0
13 return vowels.find(a) != string::npos;
14}

Referenced by main().

Here is the caller graph for this function:

◆ main()

int main ( void )

Definition at line 17 of file vowel.cpp.

18{
19 int n;
20 int numVowel = 0;
21 char c;
22 cin >> n;
23
24 for (int i = 0; i < n; ++i)
25 {
26 cin >> c;
27 if (isVowel(c))
28 numVowel++;
29 }
30
31 cout << "Number of vowels = " << numVowel << endl;
32
33 return 0;
34}
bool isVowel(char a)
Definition vowel.cpp:9

References isVowel().

Here is the call graph for this function: