Saturday, 13 April 2013

C++ program for finding the variable position in a string


/*Vowel position in a string
      By sanjay kumar singh,ggsestc*/ 

#include<iostream.h>
#include<conio.h>

void main()
{

    char ch[30];
            cout<<"enter name :";
            cin.get(ch,30);
            strlen(ch);
            for(int i=0;i<strlen(ch);i++)
            {
                    if(ch[i]=='A'||ch[i]=='a'||ch[i]=='e'||ch[i]=='E'||ch[i]=='i'||ch[i]=='I'||ch[i]=='o'||ch[i]=='O'|               
                    |ch[i]=='u'||ch[i]=='U')
                    cout<<"  the vowel   "<<ch[i]<<"   is at "<<(i+1)<<endl;
            }
            getch();
}

No comments:

Post a Comment