Find Jobs
Hire Freelancers

C Blackjack Program

$30-250 USD

已完成
已发布大约 15 年前

$30-250 USD

货到付款
Need this completed 100% percent as soon as possible. You are to write a program to help a person to play the card game called Blackjack or 21. The game is played with several standard decks of playing cards without the jokers. Each card dealt contributes points to your total as follows: cards 2-10 contribute their value to the total; the cards of Jack, Queen and King count for 10 points and an Ace can count for 1 or 11 points. The object of the game is to try to get as close to 21 points without exceeding 21 points and to try and beat the points in the dealer’s hand. The dealer must continue drawing cards for the dealer’s hand if the point total is less than 17 and must stop drawing cards for their hand if their point total is at least 17. If your total is over 21 you automatically lose. If your total is 21 or less and is greater than the dealer’s total you win. If the dealer draws more than 21 points and your point total is 21 or less you win. If your total is less than or equal to 21 and is equal to the dealer’s total you tie. (For more information about the game see [login to view URL] ) You can assume that only integer inputs will be provided. However an error message is to be displayed if an invalid integer value is entered and input is to be prompted for and re-input until valid. Testing Dialogues: Your program MUST prompt for inputs and produce outputs EXACTLY as shown below. Test dialogue 1 for a maximum mark of 60%: · Process 2 cards only · Code and correctly use following functions: - int validateCard() to prompt for, validate and return card number (Ace:1, 2:2, 3:3, …, 10:10, Jack:11, Queen:12, King: 13) - int value(int card) passed a card number and returns the value of that card (Ace: 1 point, 2:2, 3:3, …, 10:10, 11: 10, 12:10, 13:10 points) - void endResult(int highestTotal) passed the highest valid point total of your hand (i.e. highest point total that is less than or equal to 21), prompts for and validates dealer’s total (must be greater than 16 and less than 27) and displays whether you have won, tied or lost Enter card (1-13): 11 Enter card (1-13): 10 Total(s): 20 Enter dealer's total: 17 YOU WON!! Another game (1:Yes/0:No): 1 Enter card (1-13): 1 Enter card (1-13): 12 Total(s): 11, 21 Enter dealer's total: 21 TIE Another game (1:Yes/0:No): 1 Enter card (1-13): 2 Enter card (1-13): 1 Total(s): 3, 13 Enter dealer's total: 22 YOU WON!! Another game (1:Yes/0:No): -1 Error! Enter 1 for yes or 0 for no. Another game (1:Yes/0:No): 2 Error! Enter 1 for yes or 0 for no. Another game (1:Yes/0:No): 1 Enter card (1-13): 0 Error card must be between 1 and 13! Enter card: 14 Error card must be between 1 and 13! Enter card: 8 Enter card (1-13): 1 Total(s): 9, 19 Enter dealer's total: 16 Dealer total must be between 17 and 26! Enter dealer's total: 27 Dealer total must be between 17 and 26! Enter dealer's total: 20 YOU LOST!! Another game (1:Yes/0:No): -1 Error! Enter 1 for yes or 0 for no. Another game (1:Yes/0:No): 2 Error! Enter 1 for yes or 0 for no. Another game (1:Yes/0:No): 0 Test dialogue 2 for a maximum mark of 80%: · Process up to maximum of 3 cards · Code and correctly use following functions: - Functions from previous dialogue plus - int anotherCard() to prompt for, validate and return 0 (no more cards wanted) or 1 (another card wanted) - void totals(int total, int numAces, int *pLost, int *pHighestTotal) where total is the total point of cards in hand using only 1 point for each Ace, numAces is the number of Aces in hand, *pLost (value of 1 represents if point total exceeds 21, else value of 0) and *pHighestTotal represents highest point total that is less than 22 - change endResult to void endResult(int Lost, int highestTotal) which is passed Lost (value of 1 if you lost by exceeding 21, otherwise a value of 0) and the highest point total of your hand, and prompts for and validates dealer’s total (must be greater than 16 and less than 27) and then displays whether you have won, tied or lost Enter card (1-13): 11 Enter card (1-13): 8 Total(s): 18 Another card (1:Yes/0:No): 0 Enter dealer's total: 17 YOU WON!! Another game (1:Yes/0:No): 1 Enter card (1-13): 10 Enter card (1-13): 1 Total(s): 11, 21 Enter dealer's total: 21 TIE Another game (1:Yes/0:No): 1 Enter card (1-13): 13 Enter card (1-13): 5 Total(s): 15 Another card (1:Yes/0:No): 1 Enter card (1-13): 7 YOU LOST!! Another game (1:Yes/0:No): 1 Enter card (1-13): 2 Enter card (1-13): 3 Total(s): 5 Another card (1:Yes/0:No): 1 Enter card (1-13): 9 Total(s): 14 Enter dealer's total: 22 YOU WON!! Another game (1:Yes/0:No): -1 Error! Enter 1 for yes or 0 for no. Another game (1:Yes/0:No): 2 Error! Enter 1 for yes or 0 for no. Another game (1:Yes/0:No): 1 Enter card (1-13): 0 Error card must be between 1 and 13! Enter card: 14 Error card must be between 1 and 13! Enter card: 1 Enter card (1-13): 1 Total(s): 2, 12 Another card (1:Yes/0:No): -1 Error! Enter 1 for yes or 0 for no. Another card (1:Yes/0:No): 2 Error! Enter 1 for yes or 0 for no. Another card (1:Yes/0:No): 0 Enter dealer's total: 17 YOU LOST!! Another game (1:Yes/0:No): 1 Enter card (1-13): 12 Enter card (1-13): 11 Total(s): 20 Another card (1:Yes/0:No): 1 Enter card (1-13): 1 Enter dealer's total: 16 Dealer total must be between 17 and 26! Enter dealer's total: 27 Dealer total must be between 17 and 26! Enter dealer's total: 26 YOU WON!! Another game (1:Yes/0:No): 0 Test dialogue 3 for a maximum mark of 100%: · Process unlimited number of cards · Code and correctly use following functions: - Functions from previous dialogue plus - int getCard(int num, int *pTotal, int *pNumAces) to prompt for, validate and return value of card drawn where num represents the position of card to be drawn (1st, 2nd, 3rd, …), *pTotal represents the total points of cards in hand using only 1 point for each Ace, *pNumAces represents the number of Aces in hand. This function should call the validateCard and value functions. - Replace int anotherCard() with the function int anotherCardOrGame(int value) to prompt for, validate and return response to question of another card if passed a value of 1 or the question of another game if passed a value of 0 Enter card (1-13): 1 Enter card (1-13): 10 Total(s): 11, 21 Enter dealer's total: 21 TIE Another game (1:Yes/0:No): 1 Enter card (1-13): 11 Enter card (1-13): 1 Total(s): 11, 21 Enter dealer's total: 17 YOU WON!! Another game (1:Yes/0:No): 1 Enter card (1-13): 10 Enter card (1-13): 12 Total(s): 20 Another card (1:Yes/0:No): 0 Enter dealer's total: 22 YOU WON!! Another game (1:Yes/0:No): 1 Enter card (1-13): 10 Enter card (1-13): 8 Total(s): 18 Another card (1:Yes/0:No): 0 Enter dealer's total: 20 YOU LOST!! Another game (1:Yes/0:No): 1 Enter card (1-13): 1 Enter card (1-13): 1 Total(s): 2, 12 Another card (1:Yes/0:No): 1 Enter card (1-13): 9 Total(s): 11, 21 Enter dealer's total: 17 YOU WON!! Another game (1:Yes/0:No): 1 Enter card (1-13): 2 Enter card (1-13): 3 Total(s): 5 Another card (1:Yes/0:No): 1 Enter card (1-13): 3 Total(s): 8 Another card (1:Yes/0:No): 1 Enter card (1-13): 2 Total(s): 10 Another card (1:Yes/0:No): 1 Enter card (1-13): 4 Total(s): 14 Another card (1:Yes/0:No): 1 Enter card (1-13): 3 Total(s): 17 Another card (1:Yes/0:No): 0 Enter dealer's total: 17 TIE Another game (1:Yes/0:No): -1 Error! Enter 1 for yes or 0 for no. Another game (1:Yes/0:No): 2 Error! Enter 1 for yes or 0 for no. Another game (1:Yes/0:No): 1 Enter card (1-13): 0 Error card must be between 1 and 13! Enter card: 14 Error card must be between 1 and 13! Enter card: 8 Enter card (1-13): 2 Total(s): 10 Another card (1:Yes/0:No): -1 Error! Enter 1 for yes or 0 for no. Another card (1:Yes/0:No): 2 Error! Enter 1 for yes or 0 for no. Another card (1:Yes/0:No): 1 Enter card (1-13): 1 Total(s): 11, 21 Enter dealer's total: 20 YOU WON!! Another game (1:Yes/0:No): 0
项目 ID: 408221

关于此项目

9提案
远程项目
活跃15 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
Hello.. Please, check PMB...
$50 USD 在1天之内
5.0 (2条评论)
1.8
1.8
9威客以平均价$98 USD来参与此工作竞价
用户头像
hi, just new at gaf, but experienced at rac. let us do it for u.
$30 USD 在1天之内
4.9 (15条评论)
5.0
5.0
用户头像
Hi, Please check PM Thankx
$150 USD 在3天之内
5.0 (52条评论)
5.1
5.1
用户头像
Dear Sir, SERIOUS BIDDER. Please check PM. Regards, Jainam Shah, iSoft Solutions.
$160 USD 在1天之内
4.7 (6条评论)
4.5
4.5
用户头像
Please see pmb, thank u.
$129 USD 在1天之内
5.0 (4条评论)
3.7
3.7
用户头像
Hello Sir/Madam. Please check your PMB. Regards.
$100 USD 在1天之内
5.0 (1条评论)
1.3
1.3
用户头像
Please see PMB. Balthazaar.
$150 USD 在5天之内
0.0 (0条评论)
0.0
0.0
用户头像
This is simple. Please consider my bid.
$75 USD 在3天之内
0.0 (1条评论)
0.0
0.0
用户头像
Hey, I am new to GAF. But u can expect the best.
$40 USD 在1天之内
0.0 (0条评论)
0.0
0.0

关于客户

CANADA的国旗
Stouffville, Canada
5.0
7
会员自3月 26, 2009起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。