I am trying to collect numbers until EOF is reached, then convert the numbers to English.
$ ./dtoa
22
twenty two
Here is part of the program:
int num;
while(scanf("%d", &num) != EOF)
to_string(num);
The problem is, when I enter the input, then press CtrlD for EOF the last number won't actually get printed:
$ ./dtoa
22 33 44(EOF) twenty two
thirty three(EOF)
forty four
I need to press CtrlD for the last number to show up. How can I fix it so the full input will be inserted in the first EOF?