Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Word Count in C
Index -> Programming, C -> C Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Okapi




PostPosted: 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
Sponsor
sponsor
deltatux




PostPosted: 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
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 17 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: