Horje
c++ get input without loop Code Example
c++ get input without loop
#include <iostream>

int receive(void)
{
  	int input;
	if (!(std::cin >> input))
    {
      // TODO: If input is unvalid
      // Clear error flag
      std::cin.clear();
      // Remove incorrect data from buffer
      std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
    }
 	return input; 
}




Cpp

Related
how to create a pair of double quotes in c++ Code Example how to create a pair of double quotes in c++ Code Example
C++ Kelvin to Celsius Code Example C++ Kelvin to Celsius Code Example
do you need inline for template in C++ Code Example do you need inline for template in C++ Code Example
kwakiutl tribe artifacts Code Example kwakiutl tribe artifacts Code Example
cout.flush() in c++ Code Example cout.flush() in c++ Code Example

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