Bet guessing game help

Im trying to make my program look like a guessing game, here's the code:

//

// main.cpp

// RyanThomas

//

//

#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;

int main()

{
bool playAgain=true;
const int BET_MONEY = 1000;
const int NUM_GUESS = 6;
int bet;
int WIN_MONEY;
int LOSE_MONEY;
int count;
int guess;
srand(time(0));
int number;
char yaNein;
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << endl;
cout << "Are you interested in winning lots" << endl;
cout << "of easy money? Well do I have the"<< endl;
cout << "game for you: The high-low betting"<< endl;
cout << "game! Guess a number between"<< endl;
cout << "1 and 100, and if you geuss right,"<< endl;
cout << "you win!"<< endl;
cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=—"<< endl;
for (count = 0; count < NUM_GUESS; count ++)
{
cout<<"Please enter a bet: ";
cin >> bet;
if (bet > 0 && bet <= 1000)
{
cout << "Take a guess. C’mon you know you want to!" << endl;
cin >> guess;
}
else
{
cout << "INVALID BET! Please enter a valid bet:" << endl;
}
number = rand ()% 100+1;
while(guess!=number)
{
if(guess>number)
{
cout<<"Too high,Guess again: " << endl;
cin>>guess;
}

else if(guess<number)

{

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

cin>>guess;

}

}

if(guess==number)
{
WIN_MONEY = bet + BET_MONEY;
cout<< "Congrats!! You got it. You now have"<< WIN_MONEY << endl;

cout<< "Play again? Enter Y or N:" << endl;

}

if(guess!=number)

{
LOSE_MONEY = BET_MONEY - bet;
cout << "I’m sorry. The correct answer was: " << number << endl;

cout << "You now have" << LOSE_MONEY << endl;

cout << "Play again? Enter Y or N:" << endl;

cin >> yaNein;
bool playAgain (true);
}

return 0;
}
}

Theres errors that i dont know how to fix. help
yaNein is a string. The char type is not allocating enough bits to hold it. If you could post the errors it would be helpful.
Last edited on
Topic archived. No new replies allowed.