Word Count in C
Author |
Message |
Okapi
|
Posted: Fri Nov 21, 2008 10:42 am Post subject: RE:Word Count in C |
|
|
Here's another solution for your problem (I remember reading this algorithm in a C book by Dennis Ritchie.
while (c = getchar() != EOF)
{
if (c == ' ' || c == '\n' || c == '\t')
state = NO;
else if (state = NO)
state = YES;
word++;
} |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
deltatux

|
Posted: Sat Nov 29, 2008 3:40 pm Post subject: RE:Word Count in C |
|
|
Hey guys,
Sorry for taking so long to update, I was caught up with tons of other stuff and this fell off my priority list.
Thanks for the tips, I'll rework it.
deltatux |
|
|
|
|
 |
|
Page 2 of 2 [ 17 Posts ]
|
Goto page Previous 1, 2 |
|
|
|
|