Below is my code for a number guessing game. The problem seems to be that if you guess the number on the first try it doesn't display "Phenomenal! You got it on your first try!" but instead skips to the next level. It wont generate a random number in this code but the number, the computer is always 'thinking of' is 1 so u can test it. Ty and please help

#include<iostream>

using namespace std;

int main()

{

srand(time(0));

string m;

int number;

int guess, maxrand, j;

char playAgain='y';

int c;

cout << "** Guess The Number Game **\n";

cout << "The goal of this game is to guess the number I am thinking\n";

while (playAgain !='n')

{

cout <<"Select Mode:"<<endl;

cout <<""<<endl;

cout <<"Level Mode (l)"<<endl;

cout <<"Practice Mode (p)"<<endl;

cout <<""<<endl;

cin >> m;

cout <<""<<endl;

if (m == "l")

{

j = 25;

int q = 0;

do {

++q;

cout <<"*** Level "<<q<<" ***"<<endl;

cout <<""<<endl;

if (q==1)

{

cout <<"Stats:"<<endl;

cout <<""<<endl;

cout <<"Max Tries : 10"<<endl;

cout <<"Range : 1 - 25"<<endl;

cout <<""<<endl;

cout <<"Chance of Winning Level: 40% (10 is 40% of 25)"<<endl;

cout <<"Chance of Losing Level: 60% (25-10=15. 15 is 60% of 25)"<<endl;

cout <<"Chance of Guessing Right Number: 4% (1 is 4% of 25)"<<endl;

cout <<"Chance of Guessing Wrong Number: 96% (25-1=24. 24 is 96% of 25)"<<endl;

cout <<"Probability of Winning: Likely"<<endl;

cout <<""<<endl;

}

if (q==2)

{

cout <<"Stats:"<<endl;

cout <<""<<endl;

cout <<"Max Tries : 10"<<endl;

cout <<"Range : 1 - 50"<<endl;

cout <<""<<endl;

cout <<"Chance of Winning Level: 20% (10 is 20% of 50)"<<endl;

cout <<"Chance of Losing Level: 80% (50-10=40. 40 is 80% of 50)"<<endl;

cout <<"Chance of Guessing Right Number: 2% (1 is 2% of 50)"<<endl;

cout <<"Chance of Guessing Wrong Number: 98% (50-1=49. 49 is 98% of 50)"<<endl;

cout <<"Probability of Winning: Probably"<<endl;

cout <<""<<endl;

}

if (q==3)

{

cout <<"Stats:"<<endl;

cout <<""<<endl;

cout <<"Max Tries : 10"<<endl;

cout <<"Range : 1 - 100"<<endl;

cout <<""<<endl;

cout <<"Chance of Winning Level: 10% (10 is 10% of 100)"<<endl;

cout <<"Chance of Losing Level: 90% (100-10=90. 90 is 90% of 100)"<<endl;

cout <<"Chance of Guessing Right Number: 1% (1 is 1% of 100)"<<endl;

cout <<"Chance of Guessing Wrong Number: 99% (100-1=99. 99 is 99% of 100)"<<endl;

cout <<"Probability of Winning: Unlikly"<<endl;

cout <<""<<endl;

}

int tries = 0;

cout<<"Im thinking of a number between 1-"<<j<<". Take a guess (10 tries only): ";

number=1;

cin>>guess;

++tries;

cout <<" "<<endl;

cout <<" "<<endl;

while(guess!=number)

{ if (tries > 10)

{ cout <<""<<endl;

cout <<"GAME OVER!"<<endl;

cout <<"You had 10 tries and could not guess the number!"<<endl;

cout <<""<<endl;

cout <<"Btw the number was "<<number<<"!"<<endl;

guess = number;

q = 3;}

if (tries < 10)

{

do {

if (guess>j)

{cout <<" "<<endl;

cout <<"Number is only 1-"<<j<<"! Guess again: ";

cin>>guess;

}

if (guess<0)

{cout <<" "<<endl;

cout <<"Number is only 1-"<<j<<"! Guess again: ";

cin>>guess;

}

} while(guess>j || guess<0);

}

if(guess>number)

{

cout<<"Too high, Guess again: ";

cin>>guess;

++tries;

}

if(guess<number)

{

cout<<"Too low, Guess again: ";

cin>>guess;

++tries;

}

if(guess==number)

{

if (tries == 1)

{

cout <<" "<<endl;

cout <<"Phenomenal! You got it on your first try!"<<endl;

cout <<" "<<endl;

}

if (tries > 1)

cout <<" "<<endl;

cout<<"Congratulations! You got it in "<< tries <<" Guesses!" << endl;

cout <<""<<endl;

if (q == 3)

{cout <<""<<endl;

cout <<"Congratulations, you beat all the levels!!!!!!!!!!"<<endl;

cout <<""<<endl;

}

}

}

if (q == 1);

{ j = 50;}

if (q ==2)

{ j = 100;}

} while (q != 3);

}

if (m == "p")

{

cout <<" "<<endl;

cout << "Select difficulty mode:\n";

cout <<""<<endl;

cout << "1 : Easy (1-25)\n";

cout << "2 : Medium (1-50)\n";

cout << "3 : Difficult (1-100)\n";

cout <<" "<<endl;

cin >> c;

cout << "\n";

switch (c)

{

case '1' : maxrand = 25;

j = 25;

break;

break;

case '2' : maxrand = 50;

j = 50;

break;

case '3' : maxrand = 100;

j = 100;

break;

default : exit(0);

break;

}

cout<<"Im thinking of a number between 1-"<<j<<". Take a guess: ";

int number=1+rand() % maxrand;

cin>>guess;

cout <<" "<<endl;

int tries = 0;

++tries;

cout <<" "<<endl;

while(guess!=number)

{ do {

if (guess>j)

{cout <<" "<<endl;

cout <<"Number is only 1-"<<j<<"! Guess again: ";

cin>>guess;

}

if (guess<0)

{cout <<" "<<endl;

cout <<"Number is only 1-"<<j<<"! Guess again: ";

cin>>guess;

}

}

while(guess>j || guess<0);

if(guess>number)

{

cout<<"Too high, Guess again: ";

cin>>guess;

++tries;

}

if(guess<number)

{

cout<<"Too low, Guess again: ";

cin>>guess;

++tries;

}

}

if(guess==number)

{

cout <<" "<<endl;

cout<<"Congratulations! You got it in "<< tries <<" Guesses!" << endl;

}

}

do { cout <<""<<endl;

cout << "Would you like to play again? y/n: ";

cin >> playAgain;

cout <<" "<<endl;

} while (playAgain !='y' && playAgain !='n');

}

cout << "Okay, see you next time!" << endl;

cout << "Thank you for playing a game by Anmol Sethi" << endl;

cout <<""<<endl;

system ("pause");

}

Btw its for a School Probability Project.