#include <iostream>
#include <cstdio>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int rNumber = 0;
int uNumber = 0;
const int maxNum = 10;
const int minNum = 1;
const int range = maxNum - minNum;
int counter = 0;
//declare random formula
srand((unsigned int)time(NULL));
rNumber = 1 + rand() % (range + 1);
cout << "Welcome To The Guessing Game!\n";
//goes infinite until the right number is selected or they select -1
do{
while(uNumber != rNumber || uNumber != -1)
{
cout << "Please Select A Number From 1 Through 10 To See If It Matches The Random Number.\n\n";
cout << "Please Enter -1 To Exit The Program.\n\n";
cout << "Please Enter A Number: \n\n";
cin >> uNumber;
counter++;
if(rNumber = uNumber){
cout << "You have guessed wisely!\n\n";
cout << "Good Job!\n";
}
else{
if(rNumber > uNumber){
cout << "Too High, Try Again!\n\n";
}
else{
if(rNumber < uNumber){
cout << "Too Low, Try Again!\n\n";}
}
}
}//End While
cout << "You Tried " << counter << " Times\n\n";
cout << "Thank You For Playing The Guessing Game!\n";
}
return 0;
}
//The Only problem I have with this is that the code runs every time but it tells me that the selection I performed is correct and does not show action that it is creating a random number and i can't fix it, can somebody help me on this?