counting characters program in c -


The output of the letter number is the real number plus 3. I do not know why?

This code is:

  zero main (zero) {int ch, w = 0, c = 0; Do {ch = getche (); ++ C; If (f == 32) {++ w; ++ C; }} While (f = 13); Printf ("characters have \ nnum% d", c); Printf ("word \ n word is% d", w); Getch (); } 
{0}>
C = 0, lastch = 32; While ((ch = getche ())! = 13) // Get input and check that this enter key {++ c; If (f == 32 end and click! = F) // Make sure that two continuous spaces are not counted as a word, as indicated by paxdiablo ++ w; Playful; } If (Last! = 32) // One word with no words ++ w; Printf ("characters have \ nnum% d", c); Printf ("word \ n word is% d", w); Getch (); }

You can consider using char instead of int.


Comments