Heres my problem. When Start = 0, computer starts, gives indication that human won and then that computer won but doesn't return to top of game and prompt user to play again.
Second problem, some math errors somewhere in above scenario, just too tired to figure that part out right now.
Third, large problem, when complete game, and prompted again to play or not, if choose not (any character other than 1), goes into infinite loop. I'd appreciate any input!
1) You have tons of duplicate code. As a general rule, if you are copy/pasting code to multiple places in your program, you're doing it wrong. Did you learn about functions yet?
2) Learn to indent. This would me much easier to read and follow if it was properly indented.
Both of the above points would help you solve your problem. Logic is much easier to follow when it's organized and clean. Since your code is so big and messy, it's very hard to spot the logic error.
3) As for your "big problem", I'm not sure if this is it, but you seem to be using endgame incorrectly. On line 188, you probably meant to have !endgame instead of endgame.
Would you like to play a game?
Please enter 1 for yes, or 0 for no. 0
65 0 0Maybe next time! Have a great day!
This is what I get when I enter 1:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Would you like to play a game?
Please enter 1 for yes, or 0 for no. 1
31 1 0The pile has 31 marbles. On each turn, the player must choose at least one
marble, but no more than half of the marbles left in the pile. The player that
must take the last marble loses!
Your turn. How many marbles do you want to take? 15
That leaves 16 marbles.
My turn. I choose to remove 9 marbles, leaving 7 marbles.
Your turn. How many marbles do you want to take? 3
That leaves 4 marbles.
My turn. I choose to remove 1 marbles, leaving 3 marbles.
Your turn. How many marbles do you want to take? 1
That leaves 2 marbles.
My turn. I choose to remove 1 marbles, leaving 1 marbles.
I win! Better luck next time!
Would you like to play a game?
Please enter 1 for yes, or 0 for no. 0
72 1 1Maybe next time! Have a great day!]
It seems to work, but it is hard to understand what's going on in there.
This may help with what Disch said:
Google Cern C++ Coding Standard.
I've only had an interest in C++ for about 6 months, but this pdf helped alot.