sahajjain01

Find out number of vowels in a string.

Sep 21st, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. //Program to find out number of vowels in a string.
  2. #include<iostream.h>
  3. #include<conio.h>
  4. #include<stdio.h>
  5. #include<ctype.h>
  6. void main()
  7. {
  8.     clrscr();
  9.     char a[80];
  10.     int n=0;
  11.     cout<<"Enter a string: ";
  12.     gets(a);
  13.     for(int i=0;a[i]!='\0';i++)
  14.     if(a[i]=='a'||a[i]=='e'||a[i]=='i'||a[i]=='o'||a[i]=='u')
  15.     ++n;
  16.     cout<<"Number of vowels in the string: "<<n;
  17.     getch();
  18. }
Advertisement
Add Comment
Please, Sign In to add comment