Remove \n after scanf() which read integer

后端 未结 2 1824
半阙折子戏
半阙折子戏 2021-01-21 06:29

I am raw and I wrote a lot of basic programs. There is something wrong in my new schedule program. I want to caltculate total park recipes and write on screen it with car number

2条回答
  •  逝去的感伤
    2021-01-21 07:19

    As far as I'm aware this is a "problem" linked to the terminal. When you type something in the terminal your input isn't sent to the program until you press enter and enter will add a new line.

    What you have to do is change the terminal behavior, so that everything you type is immediately sent to the program.

    Have a look at this question, the top answer will show you how to do what you want to do: How to avoid press enter with any getchar()

提交回复
热议问题