All pastes #626910 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-19 23:20 UTC
rendered paste body
#include <iostream>
#include <stdio.h>

using namespace std;

int numberGuess, numberAnswer, difC, dif, guess;

int main()
{
    srand ( time(NULL) );
    cout << "Welcome to the random number game!\n\nIn this game, you will guess the randomly generated number.\n\nPlease select a difficulty from below: \n\n";
    cout << "1)Easy (0-9)\n2)Novice (0-19)\n3)Hard (0-29)\n> ";
    cin >> difC;
    if(difC == 1)
    {
         dif == 10;
    }
    else if(difC == 2)
    {
         dif == 20;
    }
    else if(difC == 3)
    {
         dif == 30;
    }
    else
    {
        cout << "Error. That is incorrect. Press enter to exit.\n";
        cin.get();
    }
    numberAnswer = rand() % dif;
    cout << "I thought of a number.....What is it?\n";
    cout << "> ";
    cin >> numberGuess;
    do
    {
        guess ++;
        cout << "Nope! Try again!\n";
        cout << "> ";
        cin >> numberGuess;
    } while(numberGuess != numberAnswer);
    
    cout << "You got it!";
    cout << "\nPress enter to quit.";
    cin.get();
    
    return 0;
}