Find Jobs
Hire Freelancers

C Blackjack Program

$30-250 USD

Đã hoàn thành
Đã đăng vào khoảng 15 năm trước

$30-250 USD

Thanh toán khi bàn giao
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
Mã dự án: 408221

Về dự án

9 đề xuất
Dự án từ xa
Hoạt động 15 năm trước

Bạn muốn kiếm tiền?

Lợi ích khi chào giá trên Freelancer

Thiết lập ngân sách và thời gian
Nhận thanh toán cho công việc
Phác thảo đề xuất của bạn
Miễn phí đăng ký và cháo giá cho công việc
Đã trao cho:
Avatar người dùng
Hello.. Please, check PMB...
$50 USD trong 1 ngày
5,0 (2 nhận xét)
1,8
1,8
9 freelancer chào giá trung bình $98 USD cho công việc này
Avatar người dùng
hi, just new at gaf, but experienced at rac. let us do it for u.
$30 USD trong 1 ngày
4,9 (15 nhận xét)
5,0
5,0
Avatar người dùng
Hi, Please check PM Thankx
$150 USD trong 3 ngày
5,0 (52 nhận xét)
5,1
5,1
Avatar người dùng
Dear Sir, SERIOUS BIDDER. Please check PM. Regards, Jainam Shah, iSoft Solutions.
$160 USD trong 1 ngày
4,7 (6 nhận xét)
4,5
4,5
Avatar người dùng
Please see pmb, thank u.
$129 USD trong 1 ngày
5,0 (4 nhận xét)
3,7
3,7
Avatar người dùng
Hello Sir/Madam. Please check your PMB. Regards.
$100 USD trong 1 ngày
5,0 (1 nhận xét)
1,3
1,3
Avatar người dùng
Please see PMB. Balthazaar.
$150 USD trong 5 ngày
0,0 (0 nhận xét)
0,0
0,0
Avatar người dùng
This is simple. Please consider my bid.
$75 USD trong 3 ngày
0,0 (1 nhận xét)
0,0
0,0
Avatar người dùng
Hey, I am new to GAF. But u can expect the best.
$40 USD trong 1 ngày
0,0 (0 nhận xét)
0,0
0,0

Về khách hàng

Cờ của CANADA
Stouffville, Canada
5,0
7
Thành viên từ thg 3 26, 2009

Xác thực khách hàng

Cảm ơn bạn! Chúng tôi đã gửi email chứa đường link để bạn lấy tín dụng miễn phí.
Đã xảy ra lỗi trong khi gửi email của bạn. Hãy thử lại.
Người Dùng Đã Đăng Ký Tổng Số Việc Đã Đăng
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Đang tải xem trước
Đã cấp quyền truy cập vị trí.
Phiên đăng nhập của bạn đã hết hạn và bạn đã bị đăng xuất. Hãy đăng nhập lại.