say i have:

int x;
cin>>x;

and i enter a char, the program crashes
or if i enter 9999999999, it also crashes
how do i stop that from happening?

also, i want the data to be input without pressing enter
i.e. for single digit input, i want to input the data as the key is pressed

e.g. "Press any key to continue" *presses d*

How do i achieve that?
thanks