Thread: need help Simple blackjack code in C

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    2

    Smile need help Simple blackjack code in C

    need write a very simple version of card game called "21"(or blackjack).for simplicity cards are only represented by theire score,there are no card suits etc.userhas initial deal of 2 cards-total score reprented by a random number between 4 and 22.he can announce his cards to the croupier or ask for one more.if he asks for one more-he gets another card (random number between 2 and 11).he can have 5 cards maximum-after this he has to announce. when he announces-his score is compared to the computer's deal (computer simply rolls a random number between 10 and 26). if one player has a score higher than 21 he loses.(both can lose). if both players have score below 21-the player which is closer to 21 wins.if both have 21- it is a draw. the simple the better!
    thank you for help!

  2. #2
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    Here is like the first real big program I ever wrote in c++ teehee.

    It's not exactly what you are asking for (it uses suites as well as face values.. and it is also written in c++) but it should get ye' on the right track.

    There are better ways to implement this program such as using linked list data structure. This is a very rudimentary program.

    Blackjack
    Last edited by The Brain; 05-13-2009 at 01:27 PM.
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  3. #3
    Banned ಠ_ಠ's Avatar
    Join Date
    Mar 2009
    Posts
    687
    ok, now write it and come back when you have a question
    ╔╗╔══╦╗
    ║║║╔╗║║
    ║╚╣╚╝║╚╗
    ╚═╩══╩═╝

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    2

    can you give me some help to write? or example?

    can you give me some help to write? or example?

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    How many increasingly simple examples do you propose to stare at, and learn nothing in the process?

    That is, before actually trying something for yourself.

    Good programmers (old and new) don't sit around waiting for someone else to give them the answer.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  2. << !! Posting Code? Read this First !! >>
    By kermi3 in forum Windows Programming
    Replies: 0
    Last Post: 10-14-2002, 01:29 PM
  3. << !! Posting Code? Read this First !! >>
    By kermi3 in forum Game Programming
    Replies: 0
    Last Post: 10-14-2002, 01:27 PM
  4. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM
  5. Simple Code, looking for input.
    By Alien_Freak in forum C Programming
    Replies: 3
    Last Post: 03-03-2002, 11:34 AM