Answer to Question #15763 in C++ for christian naumann

Question #15763
write a program that finds the vowels in a user inputted string using the function isvowel.
1
Expert's answer
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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS