Weird behaviour with std::getline and std::vector

前端 未结 3 1812

I have the following code:

std::vector final_output;
std::string input;

int tries = 0;
std::cin >> tries;

int counter = 0;
while(count         


        
3条回答
  •  长发绾君心
    2021-01-29 04:58

    You have nothing to absorb the '\n' from the first line in your standalone std::cin >> tries.

提交回复
热议问题