// guess.cpp  Example for CPS 171 J.Remen Updated Fall 00
// Just illustrates a do-while loop and an intro to the idea of a binary search
#include <iostream>
using namespace std;

				// could be assigned randomly later in the term
const char COMPCH = 'P';		// the computer's character

int main()
{	char inchar;
	int count = 0;
				// User is given a max of 10 tries to guess the computer's char
	do
	{						// get a guess and count it
		cout << "Enter a character:";
		cin >> inchar;

		count++;
							// give user some feedback
		if (inchar < COMPCH)
			cout << "Your guess is too low\n";
		else if (inchar > COMPCH)
			cout << "Your guess is too high\n";

          
	} while (inchar != COMPCH && count < 10);

					// print final message
	if (inchar == COMPCH)
		cout << "Congratulations\n";
	else
		cout << "You have had all your guesses. The computer character "
			<< "was " << COMPCH << endl;

	return 0;
}