You could also handle invalid input like this:
unsigned short int x;
bool flag = false;
cout << "Enter an integer that I will reverse i.e. 301 --> 103" << endl;
while (!flag)
{
cin >> x;
if (cin.fail() )
{
// clear error flags and flush input
cin.clear();
cin.ignore(90, '\n');
cout << "Invalid input, enter another integer" << endl;
continue;
}
flag = true;
}
cout << reverse_num(x);
cout << endl;