C++ Practice Assignment #4 – Blackjack in C++

Last edited on Dec 23, at The final argument is one of the three strings "simple", "counting", or "competitor", denoting which of the three players to use in the simulation. The dealer must hit if their card total is less than 17 or a soft 17 , and must stand if it is 17 or higher. Dec 24, at If the player neither busts nor is dealt a natural 21, play then progresses to the dealer.

Your Answer

2 freelancers are bidding on average $155 for this job

Figure out the problem. Usually it's pretty obvious when there's an output error. Anyway, before people yell at me or whatever because he didn't say this is homework, read the prompt he provided: Yup, that's a prompt alright. Last edited on Sep 28, at 1: Sep 28, at People will only yell at you because your unhelpfulness isn't necessary. Yes it may be a homework assignment but shouldn't we be at least glad that he's attempted to write the program and ended up with one that actually compiles?

Which is a lot more than what most homework providers do. I will take a look properly later. Also add the line cin. Last edited on Sep 28, at Anyway, before people yell at me or whatever because he didn't say this is homework, read the prompt he provided:. For the Player 3. This is somewhat difficult. You need to be able to also handle multiple aces. If there are any aces in the hand, and the total exceeds 21, change the 11 to a 1 i. Just generate a random number, where 1 is an ace and 10, 11, 12, and 13 represent 10 as well.

To get the right distribution of cards. You can ignore suit. Grading This is a difficult project that you should concentrate on correctness and readability. This code will be very difficult to follow without proper commenting. I will grade for correctness, readability, comments, and a separate grade for appearance of output screen. I know it's probably nothing but i wanna show i actually tried.

Last edited on Dec 24, at First of all, the getRand function your instructor provided seems really strange. Therefore, I'd like to suggest a better and more intuitive alternative, which looks like this: Holds the state of whether srand has been seeded.

Add two cards to each players hand, with a random face value in the range of 2 - I'm assuming you're just doing a two player game user against dealer AI.

In this case, ask the user if they want to hit or stand. Make sure that input is valid. Display who won, ask the user if they would like to play again. Last edited on Dec 23, at Dec 24, at 9: We have not done the getRand function in class yet. Hence the reason my teacher provided it to me. I have to use that one or else my teacher will know i used online help in my program. I appreciate all the help, but honestly i'm in the dark here.

If you could, please explain to me in detail. I will be eternally grateful to you man. For the purpose of this function, I'm going to assume you represent figures with the numbers from 11 to 13 and the ace is the number 1. You should use an array to represent a hand of cards. This way, you can make a function like this: Last edited on Dec 24, at 9: Dec 24, at Basically it'll decide what the ace should be, right?

Oh my god thank you so much. You just solved the hardest part of the program for me! Here's the problem, the characters [] used in line 1, haven't been taught to us in class yet. So if my teacher sees that, he'll know that i got it online.

Could you make the program work without those characters? Dec 25, at

Other jobs from this employer