Howdy, Stranger!

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


text analysis problem

spurs01spurs01 Member Posts: 44
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);


  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ________ [ ] free ebooks and video tutorials about [ C, PHP, MATLAB, Ruby, JavaScript, R, PL/SQL, Swift, Visual Basic .NET, Delphi, Python, Visual Basic, Assembly, Java, Go, Objective-C, C#, Scratch, Perl, C++ FoxPro, Logo, VBScript, Transact-SQL, Lisp, Hack, Ada, Lua, Apex, D, Prolog, Dart, ABAP, Clojure, Rust, Kotlin, Julia, Alice, Scala, COBOL, F#, SAS, Scheme, Erlang, Crystal, Fortran, LabVIEW, Awk, ML, Bash ] _________

Sign In or Register to comment.