text analysis problem

i'm writing a text analysis program. That mean that if i enter string
of text like :

This is a nice day
tomorrow is monday
any help out there

My question is how to input this string into the following code that will count the total number of characters , count the number of words etc...

I try creating text file n read input into it but can't work.
any suggestion out there??

int nc=0;
int nw=0;
int nl=0;
char inword=NO;
int c;

/* announce program */
printf("Text Analysis


/* This is the space where input enter... */

/* read characters and compute statistics */
/* count characters */

/* count lines */
if (c=='

/* count words */
if (c==' ' || c==' ' || c=='
inword = NO;
else if (inword==NO){
inword = YES;

/* print statistics */
printf(" Text File Statistics:

printf(" %d chars
", nc);
printf(" %d words
", nw);
printf(" &d lines
", nl);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!