Search code examples
c++validationinputstrtod

Input validation for Integer and Double data types


Because there was an error in the code when I posted this question, it is not a good question. I have deleted and replaced it with a link to a correct solution.

Correct Solution for Input Validation


Solution

  • cin.getline(buffer, '\n'); <-- is wrong, need buffer size.

    cin.getline(buffer, 10000, '\n');