Counting That's as two words in c -
Counting That's as two words in c -
#include <stdlib.h> #include <ctype.h> #include <stdio.h> int main() { unsigned long c; unsigned long line; unsigned long word; char ch; c = 0; line = 0; word = 0; printf("please come in text:\n"); while((ch = getchar()) != eof) { c ++; if (ch == '\n') { line ++; } if (ch == ' ' || ch == '\n') { word ++; } } printf( "%lu %lu %lu\n", c, word, line ); homecoming 0; }
right programme works , counts correctly characters, words, , lines. words that's, programme counts 1 word , want count 2 words. need add together business relationship that?
if(ch =='\'' || ch == ' ' || ch == '\n') { word++; }
c counting words apostrophe
Comments
Post a Comment