characters and strings.

how to write a program that calls a function and tries to count the number of character in a particular string..an example out is..
Output:

there are 2 m in the word maximum...

and the like..

tnx. :D

Last edited on
You'll need to use a loop. I suggest your function prototype look like this
int count_instances( const string& s, char c )

Give it a try and post back if you are still stuck.

BTW, there are three.
haha..oops sory for that.tsk

i cnt write a program now bcoz i dnt have yet my installer because this was recently formatted.cud u giv me a smple program for that output??
i wud really appreciate it..
tnx..(=
Last edited on
I'm sorry, but no.

You can do it yourself without thinking too hard.
Topic archived. No new replies allowed.