i want to accept only integer(0-9) and at the same time avoid accidentally alphabhet or space or enter key which will bring the cursor to the next line
so that if other than numeric is enter it will delete the entery and return the cursor where it was.
for alphabet the below code works
int c;
cout<<"enter a number ";
while (!(cin>>c))
{
gotoxy(16,1);clreol();
cin.clear();cin.ignore(25,'\n');
}
cout<<"\n\n number entered is "<<c;
how would i do it for alphabhet and '\n' and also space bar at the same time.
Also if you can tell me the code which will not move the cursor on pressing key other than numeric.