Answer to Question #15763 in C++ for christian naumann
write a program that finds the vowels in a user inputted string using the function isvowel.
1
2012-10-04T08:43:57-0400
#include<string.h>
#include<iostream.h>
char S[100];
char *str;
bool isVowel(char a){
if ((a=='a')||(a=='e')||(a=='y')||(a=='u')||(a=='i')||(a=='o')||(a=='o')) return 1;
else return false;
}
void main(){
cout<<"Enter a string: ";
cin>>S;
cout<<"Vowels: ";
str = &S[0];
for (int i=0; i<=strlen(S); i++){
& if (isVowel(*str)) cout<<*str<<' ';
& str++;
& }
cout<<"\n";
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C++
Comments
Leave a comment