/*	~jhowell/why_while.cpp		9/18/01			Drawer 76
		To motivate the introduction of "while" loops
*/

#include <iostream.h>

int main ( )
{
	int range, target, guess;
	
	cout << "This program requires two users."<<endl;
	cout << "One enters a target number; the other must guess it.\n";

	cout << "User 1: Over what range would you like me to choose? 1 - .. ? ";
	cin  >> range;
	
	cout << "User1: look away\nUser 2: Enter the target number: ";
	cin  >> target;
	
	cout << "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";	
	cout << "User 1: ";
	
	cout << "What is your guess? ";
	cin  >> guess;
		
	if (guess != target)
	{
		if (guess > target)
		{
			cout << "Your guess was too high; ";
		} else {
			cout << "Your guess was too low;  ";
		}
		
		cout << "What is your next guess? ";
		cin  >> guess;
	}
		
	if (guess != target)
	{
		if (guess > target)
		{
			cout << "Your guess was too high; ";
		} else {
			cout << "Your guess was too low;  ";
		}
		
		cout << "What is your next guess? ";
		cin  >> guess;
	}
		
	if (guess != target)
	{
		cout << "Nope, maybe next time.\n ";
	} else {
		cout << "Congratulations.  You got it!\n";
	}

	return 0;
}

