std::getline does not work inside a for-loop

后端 未结 9 2201
醉话见心
醉话见心 2020-12-15 10:28

I\'m trying to collect user\'s input in a string variable that accepts whitespaces for a specified amount of time.

Since the usual cin >> str does

9条回答
  •  甜味超标
    2020-12-15 10:57

    • Is n properly initialized from input?
    • You don't appear to be doing anything with getline. Is this what you want?
    • getline returns an istream reference. Does the fact that you're dropping it on the ground matter?

提交回复
热议问题