Challange for Cprogramming.com

This is a discussion on Challange for Cprogramming.com within the C++ Programming forums, part of the General Programming Boards category; Hi Everyone, i dont expect that someone will write this program, but still its a challange for C++ Programing lovers. ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    7

    Arrow Challange for Cprogramming.com

    Hi Everyone,

    i dont expect that someone will write this program, but still its a challange for C++ Programing lovers. Try to make this program simplier as you can. if you required any more info, you can ask by replying to this thread.

    Here is the C++ Program Description:

    Write a program that determines the score of a blackjack hand. In blackjack, a player receives
    from two to five cards. The cards 2 through 10 are scored as 2 through 10 points respectively. The
    picture cards jack, queen and king are scored as 10 points each. The goal is to come as close to a
    score of 21 as possible without exceeding 21. Hence, any score over 21 is called “busted.” The
    ace can count as either 1 or 11, whichever is better for the player.

    Some examples:

    • A player who receives two cards, an ace and a 10 can be scored as either 11 or 21. Since
    21 is a better score, this hand is scored as 21.
    • A player who receives three cards, an ace and two 8’s can be scored as either 17 or 27.
    Since 27 is a “busted” score, this hand is scored as 17.
    • A player who receives five cards, three aces and two 4’s can be scored as either 11, 21,
    31 or 41. The best score for this hand is 21.
    • A player who receives four cards, two aces and two 10’s can never be scored below 22.
    So, output will be “busted”.
    The user is asked how many cards he/she has and the user responds with one of the integers 2, 3, 4 or 5.
    The user is then asked for card values. Card values are 2 through 10, jack, queen, king and ace. A
    good way to handle input is to use the type char so that the card input 2, for example, is read as
    character ‘2’. Input the values 2 through 9 as the characters ‘2’ through ‘9’. Input the values ten,
    jack, queen, king and ace as the characters ‘t’, ‘j’, ‘q’, ‘k’ and ‘a’. You should allow upper as well
    as lowercase letters as input. You can assume that a player can receive at most five cards of same
    value or of different values.
    After reading the values the program should convert them from character values to a numeric
    card score taking special care for aces. The output is either a number between 2 and 21 or the
    word “busted.”
    ------------------------------------------------------------------------------------------------------
    if you can make this program, it would be the great help for those who are still learning C++ Programing, like me.

    Thanks In Advance .....
    Best Regards,
    Umar Ejaz

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    See my sig? Yeah. Somehow I think it applies.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Ohhh - never seen this strategy for getting your homework done for free before
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Apr 2007
    Posts
    7
    its not a Home work .... someone has told me to do this in just 6 hours, i have tried to write that program, but failed... because this program contains some advanced logic ..... so i put the challange work here ...... guys, not everything is home work !

  5. #5
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Tell that someone that you are unable to do it. If that someone happens to be your professor or teacher, and you've been slacking off, then there's not much we can do for you.

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    So post your best effort (since we have no way to verify how long you spend on it), then learn some things from what people have to say about it.

    You can't become a cook simply from learning how to read a menu.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Apr 2007
    Posts
    7
    i will post my efforts soon, ..... but still its a challange for C++ programers

  8. #8
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    No, writing Firefox, or protocol stack for a mobile phone is a challenge - this is a homework level problem even if you want to pretend that it isn't.

    We await your efforts.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  9. #9
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    While we're waiting.....

    The user is asked how many cards he/she has and the user responds with one of the integers 2, 3, 4 or 5.
    Who the hell wrote this assignment? Why would the user need to be asked how many cards he or she is holding? The Dealer (your program) should intuitively know that.


    The user is then asked for card values.
    Again, I can't see the point. This data should already be known by the Dealer. If this is BlackJack, shouldn't one be playing against the House?

    *Man, do I sound grouchy on a hangover!

  10. #10
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Quote Originally Posted by Oldman47 View Post
    Why would the user need to be asked how many cards he or she is holding?
    The game is never played. Only one hand is analyzed by the computer. That's it. Just a set of cards is used as input (as chars), and the score is put as output.

    This is such an easy task, it's disgusting to see how lazy this person is.

    Look familiar? http://faculty.elgin.edu/gmayer/Blackjack.pdf

    It's most likely he's taking a course and just tried rewriting the assignment description a little, or one prof or another ripped it from somewhere did the slight alterations, and the topic starter got stuck with it. If that is the case, and if he doesn't shape up, he'll probably fail the course.

  11. #11
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Nice detective work
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  12. #12
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    I agree, this is a new stragety for homework.
    Mayby the students whom decide not to do homework are finally becoming more intelligent.... Mayby. Even though i'm not sure how.

    I just need a little rave here...

    Will people STOP ignoring homework that professors introduce to very very lucky students that get the opportunity to get taught C++ from experts(a little over exagerated) face to face. Homework helps!!!!!! You can learn alot more from homework than other people if you actually listen to your professors.

    Thanks for that.

    Hehe

  13. #13
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    the
    word “busted.”
    As far as I know 'busted' is not actually a proper word, it is the name of an extremely bad band that is no more. It is also a slang term used by american cops when making an arrest, it is not something I would expect from an up-market Casino.

    Well, that is my post of the year...

  14. #14
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Oh... what kids these days will do to be lazy =P

    This funciton to judge the score of the hand would take like 10 minutes if even to write.

    Come on man, do your own homework!!!!!!!

    haha
    "Anyone can aspire to greatness if they try hard enough."
    - Me

  15. #15
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A challange
    By Ahmed29 in forum C++ Programming
    Replies: 39
    Last Post: 11-03-2008, 08:25 PM
  2. Digit selector... (Mathmatically complex, for some)
    By Axpen in forum C Programming
    Replies: 17
    Last Post: 08-28-2004, 02:58 PM
  3. Stuck on a friend's challange
    By wiresite in forum C++ Programming
    Replies: 32
    Last Post: 04-23-2004, 07:36 AM
  4. Timecard Challange
    By Thantos in forum Contests Board
    Replies: 2
    Last Post: 11-20-2003, 03:12 PM
  5. Chess Challange
    By kosmoludek in forum C Programming
    Replies: 4
    Last Post: 01-12-2003, 03:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21