I have a calculator application, which enquires the user to input an arithmetic expression like 10 + 15
, follow it with an =
sign, and press Enter. The program should evaluate the expression and print the result.
However, the answer is on a new line, even though I want it on the same one like
10 + 15 = 25
I tried to use ungetch
as well but it didn't work.
So how can I remove that newline character to obtain the upper result?