Hello I am working on an assignment for extra credit and I have to create a number guessing game between 5-25 I have completed my code but I see that it bugs or if inserted something wrong, can someone please help me.
Here's my code:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int num,
guess,
tries = 0;
srand(time(0));
num = rand() % 25 + 5;
cout << "Guess My Number Game\n\n";
do
{cout << "Enter a guess between 5 and 25 : ";
cin >> guess;
tries++;
if (guess > num)
cout << "Too high. Try again.";
else if (guess < num)
cout << "Too low, Try again." ;
else
cout << "Congratulations. You figured out my number in " << tries << " guesses!\n";}
while (guess != num);
return 0;
}