//Downloaded From theonlinetutorials.com
//(C)2011.All rights reserved.
#include<iostream.h>
#include<conio.h>
#include<ctype.h>
#include<stdio.h>
#include<string.h>
void main()
{
int i,j=0,l=0,u,v=0,s=0;
char st[50];
clrscr();
cout<<"Enter the string"<<endl;
gets(st);
l=strlen(st);
for(j=0;j<l;j++)
{
if((st[j]== ' '))
s=s+1;
if((st[j]=='a')||(st[j]=='e')||(st[j]=='o')||(st[j]=='i')||(st[j]=='u')||(st[j]=='A')||(st[j]=='E')||(st[j]=='O')||(st[j]=='I')||(st[j]=='U'))
v=v+1;
}
cout<<"No of Words = "<<s+1<<endl<<"No Space = "<<s<<endl<<"No of Vowels ="<<v<<endl<<"No of Characters ="<<l-s;
getch();
}
Not Satisfied ? Just search & get the result
Related posts:
- C Program – Count the number of vowels in a given string
- Sample – Program to count the number of words and characters in a sentence.
- C Program to accepts two strings and compare them. Finally it prints whether both are equal, or first string is greater than the second or the first string is less than the second string
- Sample – Program to enter a string and find its length.
- C Program – Count the number of words in a given string
