Relative Content

Tag Archive for c++validation

How can i ensure the user enter the good input type?

I want to create a code that will be a base for input check on all of my future code but i’m strugling at the point when i ask the user to re-enter him input and I don’t understand why my std::cin >> var in the if (is_var_an_int == false) statement don’t work it just get ignore and i can’t change the it and then if used a while loop it will just print at infinite. so I want to understand why my std::cin statement don’t whork. There is the code i wrote: