how we can avoid char input for int variable
//http://letsdoprogramminginc.blogspot.com/
#include <iostream>
#include<limits>
using namespace std;
int main()
{
int number;
cout<<"Enter the the Number \t";
while(!(cin>>number))
{
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(),'\n');
cout<<"Invalied input. Try Again only Numbers: ";
}
cout<<"\nYour Enter this Number \t"<<number;
cout<<"\n\n";
}
No comments:
Post a Comment