home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

C++ Blackjack program...

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2633
Discussions: 200,970, Posts: 2,379,717, Members: 246,335
Old January 18th, 2006, 11:57 PM   Digg it!   #1 (permalink)
SoMuchAnime-SoLittleTime
 
EXreaction's Avatar
 
Join Date: Aug 2003
Location: Plymouth, WI
Posts: 14,984
Blog Entries: 1
Send a message via MSN to EXreaction
C++ Blackjack program...

I am making a blackjack program for school...in C++...and I was wondering if you guys would like to try it out...

The .txt file is the source code if you want to see it...

(it is currently in Beta...because I haven't completely tested everything yet...but I haven't found any more bugs...)

If you do find a bug, could you post a screenshot of it for me? Thanks.

UPDATE: Updated the programs I uploaded...
Attached Files
File Type: zip BlackJack.zip (41.8 KB, 1735 views)
File Type: txt Blackjack.txt (9.7 KB, 4000 views)
__________________
My photography: Flickr

Lithium Studios - phpBB3, PHP, and Web Development

Last edited by EXreaction : January 21st, 2006 at 07:23 PM.
EXreaction is offline   Reply With Quote
Old January 19th, 2006, 12:18 AM     #2 (permalink)
I am a banana!
 
originel's Avatar
 
Join Date: Jun 2002
Location: Texas Tech
Posts: 3,921
Send a message via AIM to originel
recommendation: when an invalid response is entered you should print a message saying it was incorrect in addition to re-asking the question. Minor detail, but adds to the usability of the program.

i like how the program automatically calls the round over when you get 21. I don't see any memory leaks either.

bug: when multiple characters are entered at the prompt and enter is then hit, the prompt is printed 3 times. screenshot.

otherwise looks good.
originel is offline   Reply With Quote
Old January 19th, 2006, 12:32 AM     #3 (permalink)
Senior Member
 
bfcx's Avatar
 
Join Date: Oct 2002
Posts: 557
you cant double down or split or get insurance, kinda not blackjack without em hehe

and tie is called push

oh and the dealer should stay at 17

and it'd be cool to play more than 1 hand at the same time

Last edited by bfcx : January 19th, 2006 at 12:36 AM.
bfcx is offline   Reply With Quote
Old January 19th, 2006, 01:21 AM     #4 (permalink)
Senior Member
 
bfcx's Avatar
 
Join Date: Oct 2002
Posts: 557
maybe in your if else statements you should use try blocks to throw the errors, cleaner more standardized, might get some easy extra points
bfcx is offline   Reply With Quote
Old January 19th, 2006, 09:11 AM     #5 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Location: Augsburg, Germany
Posts: 5,586
Complaints:

* For "play again", don't recurse main(). Loop what's inside main() on the basis of the result of PlayAgain().

* CardValue(): Use switch/case rather than a chain of if/else.

* As I said, eliminate global variables. Pass arguments, return results. Globals make code an unreadable mess.
Peter M is offline   Reply With Quote
Old January 19th, 2006, 10:49 AM     #6 (permalink)
Senior Member
 
bfcx's Avatar
 
Join Date: Oct 2002
Posts: 557
ahh, very good points PeterM, i concure
bfcx is offline   Reply With Quote
Old January 19th, 2006, 11:33 AM     #7 (permalink)
Junior Member
 
Join Date: Jan 2006
Posts: 10
u cant double down or split or get insurance, kinda not blackjack without em ........!!!!!11
fighter 10 is offline   Reply With Quote
Old January 19th, 2006, 02:12 PM     #8 (permalink)
SoMuchAnime-SoLittleTime
 
EXreaction's Avatar
 
Join Date: Aug 2003
Location: Plymouth, WI
Posts: 14,984
Blog Entries: 1
Send a message via MSN to EXreaction
Quote:
Originally Posted by originel
recommendation: when an invalid response is entered you should print a message saying it was incorrect in addition to re-asking the question. Minor detail, but adds to the usability of the program.

Hmm...I could have something like "cout<<hs<<" is not acceptible, please enter a 'h', or a 's'."; Ya, i will see what I can do.

Quote:
Originally Posted by originel
bug: when multiple characters are entered at the prompt and enter is then hit, the prompt is printed 3 times. screenshot.

Ya, I know about when you enter in more than one character that it screws it up...I was hoping to ask my teacher how to fix that...but it took him the whole class period(lots of people had questions about their programs) to get to the person before me today...

Quote:
Originally Posted by bfcx
you cant double down or split or get insurance, kinda not blackjack without em hehe

and tie is called push

oh and the dealer should stay at 17

and it'd be cool to play more than 1 hand at the same time

Well, it is kinda hard to add in all that extra stuff like splitting, and multiple hands...this does only run in the console...so you can lose track of stuff really easy...or alteast I do when too much is going on.

Double down...ya, it would be nice, but I don't think it matters when you are not playing for credits, or money...it would just limit you to taking one card...so it isn't practical in the version I have...mabey I will add it in so you can actually bet credits later...then I will add the double down...same with insurance...

Ya, I know it is a push...but I like tied better... I will change that...

Doesn't the dealer stay on 17? On soft 17 he is supposed to hit, but he isn't on a normal 17.

Quote:
Originally Posted by Peter M
Complaints:

* For "play again", don't recurse main(). Loop what's inside main() on the basis of the result of PlayAgain().

* CardValue(): Use switch/case rather than a chain of if/else.

* As I said, eliminate global variables. Pass arguments, return results. Globals make code an unreadable mess.

I think I will change that recursive main...
EDIT: Just have each section call each other...that is what I will do.

I don't know how to do a switch/case yet.

Hmm...I love Global variables(we used them all the time in my VB class...so I kinda learned coding using them)...I will look into changing them though.

...time for me to get to work!

Last edited by EXreaction : January 19th, 2006 at 02:17 PM.
EXreaction is offline   Reply With Quote
Old January 19th, 2006, 02:18 PM     #9 (permalink)
Senior Member
 
bfcx's Avatar
 
Join Date: Oct 2002
Posts: 557
global variables should rarely be used in any language, they let you get away with them but there's much better ways of passing the info, and you dont want other functions messing with other functions variables

Ya i was just suggesting features

case switch is perty easy, look it up and get some extra credit
bfcx is offline   Reply With Quote
Old January 19th, 2006, 02:29 PM     #10 (permalink)
SoMuchAnime-SoLittleTime
 
EXreaction's Avatar
 
Join Date: Aug 2003
Location: Plymouth, WI
Posts: 14,984
Blog Entries: 1
Send a message via MSN to EXreaction
Quote:
Originally Posted by bfcx
global variables should rarely be used in any language, they let you get away with them but there's much better ways of passing the info, and you dont want other functions messing with other functions variables

Ya i was just suggesting features

case switch is perty easy, look it up and get some extra credit

Well, I will remember that! No more gloabals unless they are absolutely needed...

If I do get to adding in betting, I will probably add those extras...but they are not needed now.

Yep, I will do that...if it is anything like it is in VB, it is so easy I might have to do this ->
EXreaction is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this program ok? cpembo Security and Privacy Issues 6 September 11th, 2005 05:17 PM
Trojan: blackjack? ClubMed Networking and Internet 5 February 13th, 2005 08:42 AM
Blackjack Card Counters RayH IMO Community 6 June 27th, 2004 03:28 PM
is there any program that can....... nurdonsite2 General Tech Discussion 4 April 8th, 2003 11:21 PM
Need a program. willy_ph Applications and Operating Systems 1 June 13th, 2002 07:37 PM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (3040)
Forty-six years ago today (12)
The disrespect of Obama by Russian .. (47)
Nvidia GTX 260 problem (5)
Laptop with wireless problem. (12)
Wireless Televisions. (12)
CPU fan stops spinning randomly (11)
Regular Build (11)
windows vista security holes (17)
Internet Lost (5)
windows 7 problem (7)
Is the PSU I received dead? (13)
Point and Shoot Camera Suggestions. (6)
radeon x850xt platinum & shader.. (6)
Recent Discussions
Delete an OS (11)
Nvidia GTX 260 problem (5)
Steam ID's, Gamertags etc... (3)
Games, Cables, PCI cards, and more fo.. (6)
Dept. of HS: NSA 'Helped' Develop Vis.. (17)
Linksys WMP54GS wireless card problem.. (5)
windows vista security holes (17)
Help getting around port 80 for camer.. (5)
Skillsoft Network+ Study Software Que.. (10)
Browsers wont load websites (3)
help me pls laptop just stopped worki.. (0)
Open With ..... Win7 (3)
Laptop with wireless problem. (12)
Internet Lost (5)
virus blocking exe. files (1)
Point and Shoot Camera Suggestions. (6)
CPU fan stops spinning randomly (11)
Modern Warfare 2: Who Bought It? (65)
Is the PSU I received dead? (13)
Print spooler problem (16)
Kingston Bluetooth Dongle Driver (1)
Multiple Restarts Required at Boot (3)
webcam (0)
upgrade for hp a6101 (0)
tv not turn on-makes clicking sound (2)


All times are GMT -4. The time now is 06:25 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28