1. ## 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.

Best Regards,
Umar Ejaz

2. See my sig? Yeah. Somehow I think it applies.

4. 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. 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. 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.

7. i will post my efforts soon, ..... but still its a challange for C++ programers

8. 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.

9. 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. Originally Posted by Oldman47
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. Nice detective work

12. 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. 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. 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