#include <iostream.h>

int getNum ()
{
	int temp;

	cout << "Please type an integer between 1 and 10: ";
	cout.flush ();

	cin >> temp;

	if (temp < 1)
		throw "That number is too small.";

	if (temp > 10)
		throw "That number is too large.";

	return temp;
}

void main ()
{
	int x = 999;

	bool done;

	do
	{
		done = true;

		try
		{
			x = getNum();
		}
		catch (char* message)
		{
			cout << message << endl;
			cout << "x = " << x << endl;
			done = false;
		}
		catch (char* message2)
		{
			cout << "How did I get here?" << endl;
		}
	} while (done == false);

	cout << "Finally got x = " << x << endl;
}