Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- string checksize(string s)
- {
- if (s.length()>100)
- s.resize(100);
- return s;
- }
- int vowel(string s)
- {
- int up=0,i;
- for(i=0;i<s.length();i++)
- {
- if(s.at(i)=='a' || s.at(i)=='A' || s.at(i)=='e' || s.at(i)=='E' ||
- s.at(i)=='i' || s.at(i)=='I' || s.at(i)=='o' || s.at(i)=='O' ||
- s.at(i)=='u' || s.at(i)=='U')
- up++;
- }
- return up;
- }
- int main()
- {
- string s;
- cout<<"Enter a string: ";
- getline(cin,s);
- s=checksize(s);
- cout<<s<<endl;
- cout<<"Number of vowels: "<<vowel(s)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement