forked from CodeToExpress/dailycodebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcountVovels.cpp
More file actions
34 lines (31 loc) · 733 Bytes
/
countVovels.cpp
File metadata and controls
34 lines (31 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* @author: imkaka
* @date: 25/12/2018
*/
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int count = 0;
string str;
cout << "/* ===== Number of Vowels ===== */" << endl;
cout << "\nEnter the string: ";
cin >> str;
// transform(str.begin(), str.end(), str.begin(), ::tolower);
for (int i = 0; i < str.size(); i++)
{
if (
tolower(str[i]) == 'a' ||
tolower(str[i]) == 'e' ||
tolower(str[i]) == 'i' ||
tolower(str[i]) == 'o' ||
tolower(str[i]) == 'u')
{
count++;
}
}
// Print the result
cout<<"Number of vowels in \""<<str<<"\" = "<<count<<endl;
return 0;
}