Question: Hello, I have been working on this project, I would appreciate it if anyone could help me by pinpointing any mistakes and helping me with
Hello, I have been working on this project, I would appreciate it if anyone could help me by pinpointing any mistakes and helping me with the parts I got stuck on! I will leave the instruction of the project and my code below! Thank you!!







Thank you!!!
Binary Double Or Nothing In this project we are going to make a text based game with a save file system. Be patient, test your code often, and pay careful attention to the instructions and you will do just fine! I have tried to write the parts in such a way that they can be tested independently of each other, so if you get really stuck on one part, you can comment out your code and work on the next part. All of the code will be in one file for this lab, with each part happening right after each other, take screenshots at the points I provide sample runs. There are three total parts. Setup: The File System (You don't need to program this part, you can do it by hand) Create two files, current_save.txt and total.txt Their content should both be the number 0. Create them and put zeroes in by hand, not through programming. Part 1: The Continue System (~40 lines) Declare a variable to hold the current_game_score. Read the value from total.txt and display it as the amount of coins the user has. Read the value from current_save.txt into a variable called current_save not current_game_score. If the current save is 0: Set the current_game_score to 0. If the current_save is not 0 (Saved Game): Show the user the current_save value Present the user with two options, their input should be validated with a do while loop. These two options are 0 and 1, and each option has the following logic: Option 0: End Their Saved Game Show them their current total. . Add the current_save to their total Save this value back into total.txt Show them their new total Set current_game_score to 0. Write 0 to the current_save file. Option 1: Set Up To Continue Their Game Set the current_game_score to the current_save score. Save a 0 to the current_save file. Part 2: The Main Game: (-60 new lines) If the current game score is O, let the user know that it costs 5 coins start a new game Otherwise just display a message such as "Welcome back!" Ask the user if they would like to play. Have them enter a 1 for yes or a 0 for no. (Should be validated with a do while loop) No should display a goodbye message. 1. If they would like to play: If the current game score is O, the user is starting a new game. Do the following logic. Read the value in total.txt into a variable subtract 5 from that variable Write this value back into total.txt set the current_game_score to 5. continuing and nothing needs to be done before starting the If the current game score is not o, the user game 2. Play the game Make an int command variable. Create a do while loop whose condition is that the current_game_score isn't o (indicating they lost) AND the command isn't o 3. Inside the do while loop: Print: Double or Nothing! Guess the result of my coin flip and I'll double your money! Your current amount is Enter your guess for the coin flip: O for heads 1 for tails Next: Scan and validate the user's guess of 0 or 1. Generate a random 0 or 1. For 0, print "Heads" and for 1, print "Tails" If the user's guess was right: Double their current_game_score Inform them of the new score Ask them if they would like to flip again. Have them enter a l for yes and a 0 for no. Scan this into the command variable controlling the do while loop. If the users guess was wrong: Tell them YOU LOSE and laugh at them set their current score to 0. Write that o to current.txt End of do while loop End of "I would like to play" For testing purposes, you might want to print out the current game score at the end of your program. Part 3: The Save System (~20 lines) If the current_game_score is not 0, give the player a chance to either save their game or bank their earnings. Have them enter a 0 to bank their earnings, or a 1 to save their game. Validate their input with a do while loop. Banking Their Winnings Add the current_game_score to the total_score Write the new total back to total.txt. Write a 0 to current_save.txt Save Their Progress Write the current_game_score to the current_save.txt file. You are now done! Note that if you lose, nothing new happens. See how many coins you can make with your game! (or how far into debt you go) 1 //project 3 Binary Double or Nothing 2 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
