[C++] Input validation // Getting number only from the user input

preview_player
Показать описание
Code
#include iostream
using namespace std;

// input validation
// accepting numbers only from user

int main ()
{
int number = 0;
cout "Please enter a number: ";
while(!(cin number))
{
cout "\nPlease enter a number: ";
}
cout endl number;
return 0;
}

c++ programming
input validation
getting number only from the user input
Рекомендации по теме