Horje
c++ check if cin didn't get int Code Example
c++ check if cin didn't get int
while (std::cout << "Enter a number" && !(std::cin >> num)) {
    std::cin.clear(); //clear bad input flag
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); //discard input
    std::cout << "Invalid input; please re-enter.\n";
}




Cpp

Related
how to use sleep function in c++ windows Code Example how to use sleep function in c++ windows Code Example
remove () not working c++ Code Example remove () not working c++ Code Example
how to writt array in c++ Code Example how to writt array in c++ Code Example
class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) meaning Code Example class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) meaning Code Example
c++ check open processes Code Example c++ check open processes Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8