Thread: Deal or No Deal Proogram

  1. #1
    Registered User
    Join Date
    Mar 2010

    Deal or No Deal Proogram

    Our teacher gave us a little sample code, and told us to write a deal or no deal program in C. I am stuck as to where to start. Here is the code. Thanks in advance!!!

    #define SIZE 10
    int main (void){
    int prizes[SIZE] = {1,5,10,25,50,100,250,500,1000,5000};
    int cases[SIZE]= {0};
    const int arraylength = SIZE; //constant used for size of arrays
    srand(time(NULL)); /*seeds random number generator, not a function you create*/
    fillcases(cases, prizes, arraylength);
    void fillcases (int cases[], int prizes[], int arraylength){
    int randnum = 0;
    int i = 0;
    int sentinel=0;
    sentinel = 0;
    while (sentinel==0) {
    randnum = (rand()%SIZE); /* 0-9 inclusive */
    cases[randnum] = prizes[i];
    And then this was also given:

    1. unopenedcases this function has no output variables and takes in the cases array and arraylength variables. The function uses a loop to index through the cases array. Within the loop, an if statement is used to check if the indexed case has not been emptied yet, if the case is not empty, the case number is displayed to the screen.

    2. lookatprizes this function has no output variables and takes in the cases array, the prizes array, and the arraylength variable. The function uses a nested loop structure and this statement to test if the prize value is still within the cases array.
    if(prizes[i]==cases[j]) { printf("$%d ", prizes[i]); }

  2. #2
    Registered User
    Join Date
    Sep 2006
    Get into the game!

    You need a function to decide what the value the banker will offer for the player's case. You need a player's response to that offer. You need a way of opening a case that the player has asked to be opened.

    The idea department is a toughie, because it's not a part of C, and it's impossible to tell just what is holding you back from starting.

    Maybe play a game or two, with a pad and pen, or watch a few re-runs of the show on the net.

    There are similar threads to this on the forum, so maybe reading some of them will help give you idea's. make your program your own work, however.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Deal or No Deal listbox prob
    By kryptkat in forum Windows Programming
    Replies: 5
    Last Post: 03-30-2009, 06:53 PM
  2. pls fix my deal or no deal program
    By llinocoe in forum C Programming
    Replies: 5
    Last Post: 09-23-2008, 11:37 AM
  3. pls healp deal or no deal
    By llinocoe in forum C Programming
    Replies: 2
    Last Post: 09-19-2008, 12:23 PM
  4. Card shuffle and deal want to put on Stack
    By sugie in forum C++ Programming
    Replies: 4
    Last Post: 12-12-2005, 08:40 PM
  5. how to deal with DataModel changes...
    By Ruchikar in forum C Programming
    Replies: 1
    Last Post: 11-29-2002, 06:01 PM