got my black jack game working!
lvp is found at www.lvp.com
This is a discussion on finally within the C++ Programming forums, part of the General Programming Boards category; got my black jack game working! lvp is found at www.lvp.com...
Looks good from what I can tell. Couple of things. First off, you probably shouldn't call randomize() at the beginning of each loop, you'll tend to get bad random numbers that way. Call it at the beginning of the program and never again.
Second, to make your life easier, consider using arrays to store the values of the different cards, thus getting rid of all of your if statements.
Instead of this:
try this:Code:if(ran==11) { display='J'; cardvalue=10; } if(ran==12) { display='Q'; cardvalue=10; } etc....
And lastCode:// declared at top char cardnames[13]={'A','1','2','3','4','5','6','7','8','9','0','J','Q','K'}; int values[13]={1,2,3,4,5,6,7,8,9,10,10,10,10}; // used instead of the if statements display=cardnames[ran-1]; cardvalue=values[ran-1];you don't have aces being 1 OR 11 depending on which is better. Makes it hard to get a blackjack!
Last edited by PJYelton; 04-02-2003 at 01:09 PM.
ya aces are 1 since its my first good console program
now im learning about the "void" and how it works
heres a compiled version of it for download
http://www.mysticmagma.com/code/blackjack2.exe
i found a few little bugs in it when i was working today so i will update those really soon, and i would like to figure out how i can render a card on the screen