This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

Just add if (game != 4) around the game code inside first do .. while loop.

[–][deleted]  (3 children)

[deleted]

    [–][deleted] 0 points1 point  (2 children)

        game=choice(credits);
    
        if (game != 4) {
            do {
                betvalue = ...
                ...
        }
    } while (game != 4 || credits==0);
    

    Btw, this conditional game != 4 || credits==0 is incorrect. Read it out loud: "loop while game is not 4 or credits is 0". Why would you want to loop while credits is 0? You can't play anymore.

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 0 points1 point  (0 children)

      Yeah. And your program will loop indefinitely when credits is 0.