Thread: Dev C++ Problem!

  1. #1
    Registered User
    Join Date
    Jul 2006

    Arrow Dev C++ Problem!

    i'm having problems with dev c++, it wont let me assign a statement to a variable:

    also, i'm trying to learn how to generate a random number, here's what i want to do, i want it to generate a number betaween 1 to 13!

    here's the code i'm trying to do, could u pls see if it's correct? i havent tested it cuz it wont compile due to the error above

    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    int main(void)
          int nMoney = 100, nBet, nDCard1 = 0, nDCard2 = 0, nDCArd3 = 0;
          int nSuit,nDCard4 = 0, nDCard5 = 0;
          char dev_c;
          printf ("Your money: $ %d\n", nMoney);
          printf ("Your bet: $ ");
          scanf ("%d\n", &nBet);
          printf (">>> Here are the dealer's cards <<<");
          switch (nDCard1)
               { case 1: printf ("Ace of");
                 case 2: printf ("Two of");
                 case 3: printf ("Three of");
                 case 4: printf ("Four of");
                 case 5: printf ("Five of");
                 case 6: printf ("Six of");
                 case 7: printf ("Seven of");
                 case 8: printf ("Eight of");
                 case 9: printf ("Nine of");
                 case 10: printf ("Ten of");
                 case 11: printf ("Jack of");
                 case 12: printf ("Queen of");
                 case 13: printf ("King of");
    scanf ("%c", dev_c);
    scanf ("%c", dev_c);
    thanx a lot! i'm so glad i found this site! i'm a new member by the way

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Try adding a ; to the end of your statement. Also, there is a FAQ on random numbers.

    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jul 2006
    thanx a lot! i overlooked the semicolon! silly me! thanx again

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  2. Replies: 5
    Last Post: 11-07-2005, 11:34 PM
  3. Problem running prog I wrote in Dev C++
    By KidMan in forum C Programming
    Replies: 8
    Last Post: 09-22-2005, 01:50 AM
  4. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM