I am trying to make a game where it has the computer guess the number you pick and you tell it whether its to High (H) or to Low (L). I can't get this to loop can someone please explain why? Any help would be appreciated.

//Ruben Bedenbaugh
// 09/25/2012
#include<iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
char again = 'Y';
srand(static_cast < unsigned int >(time(0)));
int secretN=rand() % 10 +1; // random number seed generator
int tries= 0;
cout << " Pick a number between 1 and 10 and I will Guess it !" <<endl; // random number 1-100

cout << " is" << secretN <<" your secret number" <<" or is it to Higher or to Lower? > (H/L)" << endl;

++tries;

{
srand(static_cast < unsigned int >(time(0)));
int secretN=rand() % 10 - 2;
cout << " Too HIGH!!!" << endl;
cout << " Try again :)" << endl;
cout << " is " << secretN << " to High or to Low? > (H/L)" <<endl;
tries++;

}
if ( answer == 'L' )
{
srand(static_cast < unsigned int >(time(0)));
int secretN=rand() % 10 +1;
cout << " Too LOW!!!"<< endl;
cout << " Try again :)" << endl;
cout << " is " << secretN << " to High or to Low?> (H/L)" <<endl;
tries++;
}

cout << "I got it!" <<""<< " tries."<<tries << endl;
cout << "Would you like to try again"<<endl;
cin >> again;
again = 'Y';

 ``1234567891011121314151617181920212223242526272829303132333435363738`` ``````#include #include #include #include #include using namespace std; int main() { start: char hOrL, playAgain; int num, guess, randStart = 1; cout << "Pick a number between 1 & 10 and I will guess it!" << endl; cin >> num; srand(time(NULL)); while(num != guess ) { guess = (rand() % 10) + randStart; if (guess == num) break; cout << "Is my guess - " << guess <<" - to high or too low? (H/L): "; cin >> hOrL; if (hOrL == 'H' || hOrL == 'h') randStart--; else randStart++; } cout << "I guess your number...it is " << num << "!" << endl; cout << endl << "Would you like to play again? (Y/N): "; cin >> playAgain; if (playAgain == 'Y' || playAgain == 'y') goto start; return 0; }``````