Quote:
|
not getting what I'm expecting
|
So what were you getting?
Show some output.
Explain how it differs from what you were expecting...
You have several things wrong there,, each a mini-discussion in itself.
'Build' your code in steps.
Test as you go.
Then you will see EXACTLY what causes these problems.
You can solve them as you go along.
You will learn better habits and not repeat the same things as much.
I would suggest that you drop back and rebuild that from the beginning.
Start with only the variables and statements needed for the first thing say the getchar() loop.
A couple of notes in that regard:
Code:
while ( (ch = getchar()) != EOF )
/* looking for EOF to come from stdin causes endless loop for me in win32
(not sure about linux) try : '\n' ...that is sent when we press the "ENTER" key */
/**********/
/* fflush(stdin); ***fflush() is intended for stdout, */
/* ....for an effective pause/flush try this instead: */
while( getchar() != '\n')
Post back progress and next problem.