///Geoff Hagopian
///checking
/**
PPP4#4. Write a program to play a numbers guessing game. The computer
thinks of a number between 1 and 100 and tells you if your guess is
too big or too small.
You should be able to identify the number after no more than seven quesses.
Hint: Use the < and <= operators and the if-else construct.
**/
#include "std_lib_facilities.h"
#include <cstdlib>
#include <ctime>



int main() {
    int secretNumber{0}, guess{0};
    int guessCount{0};
    srand(time(0));  ///seed the random number generator (do this only once)
    secretNumber = 1+rand()%128;  ///A random number between 1 and 100
    while(guess != secretNumber && guessCount <= 7) {
        cout << "\nGuess the secret number: ";
        cin >> guess;
        if(guess<secretNumber)
            cout << "\nYour number is too small.";
        else if(guess>secretNumber)
            cout << "\nYour number is too big.";
        ++guessCount;
        cout << "\nYou have " << 7-guessCount << " more guesses.";
    }
    if(guessCount > 7 && guess != secretNumber)
        cout << "\nYou didn't guess " << secretNumber << "!";
    else cout << "Congratulations!";
}
