solve problems
Thursday, 21 July 2011
Program to count the number of occurrence of a character in a string. Example in ‘beautiful’ occurrence of u is 2. in C++
BlogThis!
|
Email This!
|
Print This!
|
No comments
Do you like this post?
#include
#include
# include
void main()
{
char str[50],ch;
int count=0;
int i,n;
clrscr();
cout<<"Enter any character :"; cin>>str;
cout<
>ch;
for(i=0;i
{
if(ch==str[i])
{
count++;
}
}
cout<<"The character "<
getch();
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment