C program to count the words, C/C++ Programming

Assignment Help:

C program to count the words:

void CountWords();

         void main()

         {

            printf("\n\tcount the words and enter string\n\n\n");

            CountWords();

 

         }

        void CountWords()

        {

            char c;

            int num=0;

            int flag= 0;

             while((c=getchar())!='\n')

            {

                                                if((c==' ')||(c=='               ')||(c=='.')||(c==';')||(c==',')||(c==';')

                                                                ||(c==':')||(c=='"')||(c=='?')||(c=='!')||(c=='-'))

              {

                flag=0 ;       

              }                         

              else if(flag==0)

              {

                num++;

                flag=1;    

              }

 

           }

              printf("\t\n\n\nNumber of words is %d\n",num);

         }


Related Discussions:- C program to count the words

Program that implements inference given a bayesian network, In this problem...

In this problem, you will write a program that implements two algorithms for performing exact inference given a Bayesian network, namely, enumeration and variable elimination. Your

Return values, What is the purpose of return values? Can you not return any...

What is the purpose of return values? Can you not return any values from a function? If you could what would he function look like?

Implement a algorithm to verify if the link list , Implement a Algorithm to...

Implement a Algorithm to verify if the link list is in Ascending order? A: template bool linklist::isAscending() const{ nodeptr ptr = head; while (ptr->_next)

Develop a biomedical imaging project, Develop a biomedical imaging project ...

Develop a biomedical imaging project Project Description: This is a biomedical imaging project. Skills required are C++ Programming, Cocoa, Mac OS, Objective C

#title. sentinel controlled loop, #question.develop an algorithm using pseu...

#question.develop an algorithm using pseudocode for computing cos(x) and sin(x). use a sentinel controlled while loop. use the series definition of e^+-jx

Algorithm, Write a algorithm to explain the processof wakingbup in morning

Write a algorithm to explain the processof wakingbup in morning

What are arrays, What are Arrays? Numerous applications require the pro...

What are Arrays? Numerous applications require the processing of multiple data items that have identical characteristics. In such circumstances it is frequently convenient to p

Program is to define a class as employee, Program is to define a class as e...

Program is to define a class as employee: Write a program to define a class as employee and collect information about them by using classes and object class employee   {

Program to create a digital clock, Create a C language code, only one progr...

Create a C language code, only one program, to implement the following task. Task: Write C code for a program that implements a digital clock (HH:MM:SS). The clock inclu

Algorithms, algorithm to find out all the factors of given positive integer...

algorithm to find out all the factors of given positive integers

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd