C++ Blackjack Program Using Classes

19.06.2020
77 Comments

Im tasked with developing a simple blackjack program for a class. The program I have currently compiles and runs but it isnt paying out properly. A blackjack (21) should pay out 1.5*the wager, but it is doing it more than it should. Here is the code I have.

I know the problem is in my if else statements im just not sure how to make it work. Thanks for the help.

C++ Blackjack Program

C++
  • 3 Contributors
  • forum3 Replies
  • 3,128 Views
  • 7 Hours Discussion Span
  • commentLatest Postby spookyfish

May 20, 2017  When a class is defined, no memory is allocated but when it is instantiated (i.e. An object is created) memory is allocated. Defining Class and Declaring Objects. A class is defined in C using keyword class followed by the name of class. The body of class is defined inside the curly brackets and terminated by a semicolon at the end. So I have recently received a new assignment in class to create a blackjack program. I have been out for quite a few classes and it's affected my ability to do this program. I struggle greatly in C and i'm trying my best, (i have a B right now) and i don't want to fail this because this program is worth a lot of points. Oct 19, 2010  Related C Topics beta. Best casino guest service. Black Jack - How To Write A Computer Program In C On Black Jack In C; Black Jack Project - Black Jack School Project; Classes - Putting Structures And Functions To Classes; Converting Structures And Functions To Classes; Help With Black Jack Project. Possible Rand # Generator Issue; First Black Jack Hand Always Same. Write a program to play blackjack using C classes. Blackjack is a card game that has a dealer and 1 or more players who are trying to get a hand closest to 21 without going over. Aces can be 1 or 11, whichever is to your advantage, and all face value cards (Jack, Queen and King) have a value of 10. Let's take a look at a real-world example and a fun one as well. The game Blackjack lends itself well to object-oriented design because it has physical objects that can be modeled in object-oriented code; for example, players, a dealer, cards, and so on. These objects have relationships to one.

This may or may not be part of the problem, but it needs to be adressed:

I did the same thing when I was first learning boolean logic and performing tests, and it took me a long time to understand why things are the way they are, but for now just trust me.. you would think the above is correct, but there is a specific way that boolean tests are handled, either in a singular expression, or a stand-alone variable (which yeilds true or false, non-zero and zero respectively)

So, keep in mind, boolean logic is handled individually per expression, or as a stand alone TRUE/FALSE flag.

Ramada Limited Augusta Fort Gordon Area is located approximately 116 miles from Hilton Head Island. They are regarded as one of the best Casinos in Hilton Head Island area. They are regarded as one of the best Casinos in Hilton Head Island area. Closest casino to hilton head island.

spookyfish commented: Helped me solve my problem really quickly!+0

This is a blackjack program using array. It works in Devc++ but doesn't work in visual C++.I think I am missing some kind of header files could anyone help me out?
my email is ..
thanks

Edited by ravi1986: Email Snipped. Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).
  • 3 Contributors
  • forum5 Replies
  • 878 Views
  • 1 Day Discussion Span
  • commentLatest Postby Lerner

What does 'it doesn't work' mean?

C++ Program Examples With Classes

Or you could try this: if it compiles in VC++, then run it through the debugger in VC++ or manually debug it by adding ouput statements after each action within the program to see where it fails.