Sunday, 8 April 2018

Write a program that take a string from the user find the Vowels in the string using pointer.

#include<iostream>
#include<conio.h>
using namespace std;
int main ()
{
char text[100],*ptr;
int count=0;
cout<<"Enter string:";
cin.get(text,20);
ptr=text;
for(;*ptr!='\0';*ptr++)
{
if(*ptr=='a'||*ptr=='A'||*ptr=='e'||*ptr=='E'||*ptr=='i'||*ptr=='I'||*ptr=='o'||*ptr=='O'||*ptr=='u'||*ptr=='U')
{
cout<<"Vowels letter usein your string is :"<<*ptr<<endl;
count=count+1;
}
}cout<<count<<" vowel letters are use in your string.";
return 0;
}

No comments:

Post a Comment