What is the best way to handle user input validation?

后端 未结 0 1504
温柔的废话
温柔的废话 2021-01-15 01:38

I want to know which is better method to validate input:

int x;
while(true){
    std::cout << "x: ";
    if(std::cin >> x)
        break         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题