![]() |
| ||
| "Craps", Game Help I've been studying VC++ for about 2 months, and I was working on my first game from a book (Game Programming All In One) The game is 'Craps', it's a dice game. Anyways, I've had a few prolems with the codeing, can someone help me? (Windows 32 Console) Here is the game.... Code: #include <iostream> // Includeing HeadersI've had a few problems with this book already, it's about 2 years old or so, it uses an older version of c++ and there has been some modifications over those few years. ANYWAYS!!! I need help, here are the errors! c:\Projects\Craps\Craps.cpp(151): error C2065: 'MoneyEarned' : undeclared identifier c:\Projects\Craps\Craps.cpp(95): error C2601: 'DoDiceThrow' : local function definitions are illegal c:\Projects\Craps\Craps.cpp(123): error C2601: 'DoMoneyCalc' : local function definitions are illegal c:\Projects\Craps\Craps.cpp(26): warning C4244: '=' : conversion from 'unsigned long' to 'short', possible loss of data __________________ |
| ||
| Re: "Craps", Game Help Well I got it to compile and run. Here's the errors that I found: Your function prototypes didn't match the function's return type in it's code. (Aka, return a short but prototype says it returns void.) You didn't close all functions with braces. Forgot a few :-P You closed the switch statement with a brace but didn't open with one. Other than that it's all good. One thing that I would change, not bad code just style, is to not use tab in the parameter list of a function and don't use it inside strings unless needed. Here's the output from the console and I think you'll see what I mean about tabs in strings. It makes it hard to read. Welcome to Craps 1.0 Other than that, nice job overall! Here's the revised code: #include <iostream> // Includeing Headers |
| ||
| Re: "Craps", Game Help Thanks! ^^ I'm still having some issues with it, but it was just a test! |
| ||
| I saw the following in your code: - You're missing the closing parenthesis of GetBet(void) - You're also missing the opening parenthesis on the switch(Bet) in DoMoneyCalc() - You are using break; break; in the switch(Bet) statement, you only need 1 break; - Also in the switch(Bet) you have default; but you need to use default: (notice the : ) You should add main() type int |
| ||
| Your program working #include <iostream> // Includeing Headers |
| All times are GMT -4. The time now is 1:54 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC