Thread: c progammimg problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    8

    c progammimg problem

    hi. i am having problem with the loop in my program. i am only a beginner and struggling with c program. i hope to pass this course so please help me.

    PROBLEM: when ever i enter a 'y' in the loop, the loop continues but i want it to ask if i want to play again in between. here is my code:


    the output should be:

    Code:
    Would you like to play inBetween [y|n]? y
    Die 1: 2 Die 2: 8
    Not the same, let's play!
    Number of chips: 100
    Place your bet: 10
    Die 3: 5
    *** You win! ***
    You now have 110 chips!
    Play again [y|n]? y
    Die 1: 1 Die 2: 10
    Not the same, let's play!
    Number of chips: 110
    Place your bet: 10
    Die 3: 5
    *** You win! ***
    You now have 120 chips!
    Play again [y|n]? y
    Die 1: 9 Die 2: 9
    Even-steven - let's play again!
    Play again [y|n]? y
    Die 1: 3 Die 2: 5
    Not the same, let's play!
    Number of chips: 120
    Place your bet: 20
    Die 3: 6
    *** Sorry - You lose! ***
    You now have 100 chips!
    Play again [y|n]? n
    Thanks for playing!
    any help would be appreciated
    Last edited by amie001; 06-05-2011 at 08:39 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. strcmp problem, whats the problem, i cant figure it out!
    By AvaGodess in forum C Programming
    Replies: 14
    Last Post: 10-18-2008, 06:45 PM
  2. Replies: 4
    Last Post: 10-16-2008, 07:30 PM
  3. Visual Studio Linker problem or my problem?
    By OOPboredom in forum C Programming
    Replies: 2
    Last Post: 04-13-2004, 12:32 AM
  4. syntax linked list problem & struct problem
    By beely in forum C Programming
    Replies: 5
    Last Post: 11-11-2002, 09:14 AM
  5. Texture Problem(I got the NeHe tut working, but I have a problem)
    By SyntaxBubble in forum Game Programming
    Replies: 2
    Last Post: 12-02-2001, 10:40 PM