How to read space separated numbers from console?

后端 未结 5 1775
无人共我
无人共我 2021-01-12 03:13

I\'m trying to do a simple task of reading space separated numbers from console into a vector, but I\'m not getting how to do this properly.

5条回答
  •  心在旅途
    2021-01-12 03:39

    Also, might be helpful to know that you can stimulate an EOF - Press 'ctrl-z' (windows only, unix-like systems use ctrl-d) in the command line, after you have finished with your inputs. Should help you when you're testing little programs like this - without having to type in an invalid character.

提交回复
热议问题