*FIX C++ CODE* I have a couple of errors in my c++ code that I need…

Question Answered step-by-step *FIX C++ CODE* I have a couple of errors in my c++ code that I need… *FIX C++ CODE* I have a couple of errors in my c++ code that I need help fixing.#include using namespace std;// Implements a game of double-or-nothing heads-or-tails, and explores a betting system.// Rules of double-or-nothing heads-or-tails:// – Player places bet from available money.// – Coin is flipped.// – If coin is heads: player receives 2x bet// – If coin is tails: player loses bet// – Lose condition: player runs out of money// – Win condition: player leaves with goal amount of money// Rules of betting system:// – Player has goal of making X dollars.// – Player bets goal of X dollars at start.// – If player wins bet, they leave & win.// – If player loses bet, they bet the lesser of either://       – Sum of losses & goal, or their entire available money supply// – If player has no money they lose.// Betting System Exploration:// – Take user inputs: //      – Available money to player at start//      – Player goal earnings// – Produce outputs://      – Average game length  //      – Probability that player will win vs. lose//  – Expected Value of Playing Gamestruct game_result{int rounds_played; // length of game  bool isWin; // true if win, false if loss};// Rules of double-or-nothing heads-or-tails:// – Player places bet from available money.// – Coin is flipped.// – If coin is heads: player receives 2x bet// – If coin is tails: player loses bet// Inputs: int bet – the amount of money that the player is betting// Outputs: int – the total amount of money returned to the player after the round is playedint play_round(int bet){ // Say heads are even, tails are odd from rand() if (rand() % 2 == 0) {  // Coin came up heads   // cout << rand() %2 ;   if (rand()%2==0)   {       return bet *2;   } }  return 0;}// Rules of betting system:// - Player has goal of making X dollars.// - If player wins bet, they leave & win.// - If player loses bet, they bet the lesser of either://       - Sum of losses & goal, or their entire available money supply// - If player has no money they lose.//  Inputs://      - int start_money - avaiable money to player at start//      - int goal_earnings - goal net winnings for player winnings//  Outputs://      - game_result - result of the gamestruct Game_result{int rounds_played; // length of game  bool isWin; // true if win, false if loss};Game_result play_game(int start_money, int goal_earnings){     // Sets up a variable to hold the results of the game. struct Game_result result; // int result.rounds_played, bool result.isWin  // Sets up a variable to store the current amount that the player has in their money supply. int current_money = start_money;   // Sets up a variable to store the total amount the player would have in their // money to leave the game with a win. int goal_money = start_money + goal_earnings;  // Sets up variables to hold temporary values within the loop int round_counter = 0; int desired_bet; int round_bet; int round_winnings;  // Sets up a loop to play multiple rounds while (current_money > 0) {   // Checks if the player has won their goal, so the win can be recorded.   if (current_money >= goal_money)   {     result.isWin = true;     results.rounds_played = round_counter;     results.net_earnings = current_money – start_money;     // returns the win-result     return result;        }   //for this winning betting strategy, the player would like to bet enough to get to their goal   desired_bet = goal_money – current_money;   // If structure to determine the amount the player can actually bet based on what they have available   // If the player can afford to bet their desired_bet   if (current_money > desired_bet)   {       round_bet = desired_bet;   }   //otherwise the player just bets what they have   else   {       round_bet = current_money;   }   //uses the helper function to play a round to return the winnings   round_winnings = play_round(round_bet);   //Adjusts the available money based on the winnings and the bets   current_money = current_money – round_bet + round_winnings;   // Records the round in the round_counter   round_counter ++;   // if the player runs out of money, the loop will end. And the function will execute this code       result.isWin = false;       result.rounds_played = round_counter;       result.net_earnings = 0 – start_money;              //Returns the win-result       return result;   } }}void print_histogram (int values[ ], int size, int num_bins){   //finds the highest and the lowest values withing the array    int lowest = INT_MAX;   int highest = INT_MIN;      for (int i=0; i highest)   }} int main(){  // Initialize variables to store user inputs.  int start_money = 0;   int goal_earnings = 0;  int simulations = 1;     // Request user inputs   cout << "Please enter the money the player has at the start: ";   cin >> start_money;   cout << "";  cin >> ______;    cout << "";  cin >> ______;  // Print user inputs, w/ all variables   // ______    // Sets up the random generator   srand(0); //The function should be 5 characters long   // Sets up variables for required summary statistics from simulations.  Game_result results[simulations];   // Loop for simulating all games  for(int i = 0; i < simulations; i++)   {      // results[i] = play_game(start_money, goal_earnings);   }    return 0;} Computer Science Engineering & Technology C++ Programming CIS 581 Share QuestionEmailCopy link Comments (0)