std::cout not working inside a for-loop

前端 未结 2 2016
暗喜
暗喜 2021-01-22 12:13

I\'m new to C++, and right now I\'m learning from the book called Accelerated C++. I finished the third chapter (vectors), and I came to this exercise:

\"Write

2条回答
  •  醉话见心
    2021-01-22 12:47

    Add << flush to flush your output buffer (each place).

    Or use << endl, which both adds newline and flushes.

    There are problems with the code, especially for empty input, but that's what you're out to learn about, so I'll leave you to it! :-)

    Cheers & hth.,

提交回复
热议问题