-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathString2.cpp
40 lines (35 loc) · 999 Bytes
/
String2.cpp
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
35
36
37
38
39
40
// write a progarm to check the no of vowels in the given letter:
// program of counting the vowels in provided word or a string:
#include<iostream>
using namespace std;
class vowels
{
private:
char str[30];
int count=0;
public:
void input()
{
cout<<"Enter the string whose vowels letter is to be count: "<<endl;
gets(str);
}
void know_count()
{
for(int i=0; str[i] != '\0'; i++)
{
if(str[i]=='a'||str[i]=='A'||str[i]=='e'||str[i]=='E'||str[i]=='i'||str[i]=='I'||
str[i]=='o'||str[i]=='O'||str[i]=='u'||str[i]=='U')
{
count++;
}
}
cout<<"The Number of vowels in given string is: "<<count<<endl;
}
};
int main()
{
vowels letter;
cout<<"its a simple program using the knowledge of c language:"<<endl;
letter.input();
letter.know_count();
}