C++ Blackjack Program Using Classes

  1. C++ Program Examples With Classes
  2. Blackjack Program
C++ Blackjack Program Using ClassesExamples

This is the second part of the tutorial. It will have the codes and the solution. This tutorial will show you how you can make a blackjack game in C using classes and arrays. Download files in. I've started teaching myself C and have been trying to write a blackjack program. I'm trying to use classes to represent the cards, deck, and hands. I believe everything is working in the program so far except the dealCardToHand method. Project 1 - A Blackjack Game in C Arnaud Declercq Thomas Hoyoux ebruaryF 2010 1. OT represent a dynamic collection of objects of whatever class, use std::vector from the C standard library. Use a constiterator to iterate through a vector. Improve your Blackjack game program by forcing the deck to repopulate before a round if.

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.

C++ Program Examples With Classes

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

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

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)

C++ blackjack program

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

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).

Blackjack Program

  • 3 Contributors
  • forum5 Replies
  • 878 Views
  • 1 Day Discussion Span
  • commentLatest Postby Lerner

What does 'it doesn't work' mean?

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.