0

C++ HELP NEEDED! Thank You

Create a standard deck of cards using an array. (1-dimensional or 2-dimensional, up to you). The deck should have 52 cards. The deck should have 13 ranks (1 to King) for each of the 4 suits (Spades, Hearts, Clubs and Diamonds). After that, add in code that will be able to draw cards randomly from the deck. Draw 2 cards from the deck and check if they are a pair (having the same rank). Repeat this at least 1000 times and calculate the probability of drawing a pair from a deck of cards. Justify whether or not the probability you found is logical. Point out, if there exists, any problem or flaw with the method used that will cause the result to be inaccurate.

16th Jul 2018, 5:12 PM
patricia tan
patricia tan - avatar
3 Antworten
+ 4
So, what exactly are you needing help on? Sounds like a pretty straight forward task. What have you already tried? Post up your current code so we can check it out. What errors are you getting when you try? Give us more information instead of just copying/pasting your homework. If you're simply here because you want us to do your homework, then you need to fail the class so you can properly learn it the next time around. School isn't about passing, it's about learning. Tests are called assessments because they let you know what you still need to learn.
16th Jul 2018, 5:44 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 4
Pls post your code here so we can help solving the troubles
17th Jul 2018, 3:26 AM
Shahil Ahmed
Shahil Ahmed - avatar
+ 3
I see no one has answered. I made a code that does what you said. I didn't need an array because there are only two cards to be drawn. The main reason why the results aren't accurate is the small number of draws (1000). For more draws, like 32000, the result gets closer to the real probability. https://code.sololearn.com/c5y3ungaR6Gh
18th Jul 2018, 8:23 PM
lion
lion - avatar