I think this is a prime example of TMTOWTDI (There's More Than One Way
To Do It) - you now have two choices for how to indicate the end of
input to your while() loop:
1) pressing ^Z instead of ^D
2) breaking out of your loop when you see certain input indicating end
of input
-dave
ps - I think
On Fri, Mar 22, 2002 at 09:37:05AM -0500, David Gray wrote:
> while() will create an infinite loop,
No, it won't. The "while ()" idiom will read one line at a
time and automatically terminate the loop at the end of the file.
> so you do need some sort of
> sentinel value to break out of the lo
> In the program below I don't know when to stop the loop.
> (CTRL + d ) will just terminate the program, leaving the
> data via STDIN unattended, this is my problem.
>
> Lets define what I want to do:
> I want to print the frequency of every word at the beginning.
> and every word at the end
In the program below I don't know when to stop the loop.
(CTRL + d ) will just terminate the program, leaving the data via STDIN unattended,
this is my problem.
Lets define what I want to do:
I want to print the frequency of every word at the beginning. and every word at the
end of a line.
Th