how do I pervent a char being input

I want to set up a output input to get a positive number

1
2
3
4
5
6
7
8
9
int hop;

cout << "What is the transmition range?" << endl;
cin  >> hop;
do{
    cout << "Invalid entery, no node can communicate." << endl 
      << "What is the transmition range?" << endl;
    cin  >> hop;
}while (hop =< 0);


it works fine if I put in a number but if I put in a letter or char (on accident) it just repeats forever, is there a way to prevent this?
Topic archived. No new replies allowed.