Hi you can customize it the problem is that when i put 5 it say to low then when i put 6 it say to high or any numbers pls help me..
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <conio.h>
#include <cmath>
using namespace std;
char ans;
int main()
{
do
{
srand(time(0));
int randomNumber = rand() % 10+1;
int guess = 0;
{
system ("cls");
cout << "\tThe Number Guessing Game\n\n";
cout << "Enter your guess (#1-10): ";
cin >> guess;
{
if (guess < randomNumber)
cout << "Your guess was too low\n\n";
if (guess > randomNumber)
cout << "Your guess was too high\n\n";
if (guess != randomNumber)
cout << "Try Again\n";
if (guess == randomNumber)
cout << "\nCongratulations! You've guessed the number.\n\n";
}
}
cout <<"You want to try again??";
cin >> ans;
}
while ((ans=='y')||(ans=='Y'));
cout <<"Thank You!!";
getch();
}