Thread: Function for betting within blackjack program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    Function for betting within blackjack program

    So here is my problem. The betting function is the only part of my program not working right. I am sure it is something simple, but I am missing it.

    1. keeps showing minimum bet message when betting over 10 which is wrong
    2. doesn't loop correctly, if I put in an amount lower than 10 I get the right message, if I do it twice it just goes to playing which is wrong. I can enter the whole code if needed.

    Code:
    int betting() /*Asks user amount to bet*/
    {
     printf("\n\nEnter Bet: $");
     scanf("%d", &bet);
    
     for (bet >= 10002){ /*If player tries to bet more money than player has*/
     
    		printf("\nYou cannot bet more money than you have.\n");
            return 0;
     }
     else if(bet <= 10){ /*If a player tries to bet under the minimum*/
     
    		printf("\nThe minimum bet at this table is 10 dollars.\n");
     else printf("\nGood bet!!");
    		return 0;
      }
     }
     else return bet;
    } /*End Function*/
    Last edited by wdewalt; 04-28-2009 at 07:17 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. one function in my program won't work....
    By talz13 in forum C++ Programming
    Replies: 12
    Last Post: 04-06-2003, 12:19 PM
  3. Replies: 2
    Last Post: 05-10-2002, 04:16 PM
  4. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 10:00 AM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM