C program for function of count the characters in each word, C/C++ Programming

C Program for FUNCTION OF COUNT THE CHARACTERS IN EACH WORD

void count(char c[]);

void main()

{

          char a[50];

          int i=0;

          clrscr();

          printf("ENTER THE STRING: ");

          do

          {

                   a[i++]=getchar();

          }while(a[i-1]!='\n');

 

          a[i]='\0';

          count(a);

          getch();

}

void count(char a[])

{

          int i=0,l[25],c=0;

          for(i=0;i<25;i++)

                   l[i]=0;

          for(i=0;a[i]!='\0';i++)

          {

                   if(a[i]!=' ' && a[i]!='\n')

                             l[c]=l[c]+1;

                   else

                             c++;

          }

          for(i=0;l[i]!=0;i++)

                   printf("WORD : %d : %d\n",i+1,l[i]);

}

 

OUTPUT :

ENTER THE STRING: KAMLESH D MENGAR

 

WORD 1 : 7

WORD 2 : 1

WORD 3 : 6

Posted Date: 9/10/2012 7:50:36 AM | Location : United States







Related Discussions:- C program for function of count the characters in each word, Assignment Help, Ask Question on C program for function of count the characters in each word, Get Answer, Expert's Help, C program for function of count the characters in each word Discussions

Write discussion on C program for function of count the characters in each word
Your posts are moderated
Related Questions
Rewrite the recursive bisection root finding function from lecture to be iterative (using a while loop). The function declaration should be root = bisectIter(f,a,b,tol). The input

Yes. "Memory pools" are useful in many situations. The bad news is that I'll need to drag you through the mire of how it acts before we talk about all the uses. Firstly, recall

Can you think of a condition where your program would crash without attaining the breakball, which you set at the straining of main()? A: C++ let for dynamic initialization of g

I want to take 1.1 as input but when I am declaring it as float the output is given as 1.1000000

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Hey vrcoder I have got similar way but the game builder has sent me the game unfinished and left. I saw it on a link on line but they have wiped the old message with the link in it

How does an ERP System facilitates better decision making?

Q: Name the operators which cannot be overloaded? A:sizeof, ., .*, .->, ::, ?:

Define  T y pe c o m p a t i b i li t y? T o a s s i g n i n t t o s m a l l i n t t h e v a r i a b l e should b e

A: C++, unlike only about every other language with exceptions, is extremely accomodating while it comes to what you can throw. Actually, you can throw anything you akin to. That b