![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
PFO Founder
![]() ![]() |
ok here is the code i have so far
#include <iostream>
#include <string>
#include "DiceGameDice.h"
#include "Dice.h"
using namespace DiceNameSpace;
using namespace std;
DiceGameDice::DiceGameDice() : public Dice(6)
{
total = 0;
}
int DiceGameDice::GetDiceValue(Die aDie)
{
return aDie.Value();
int DiceGameDice::Total(Dice theDice)
{
int dcount = DieCount();
for(int i = 0; i < dcount; i++)
total = total + GetDiceValue(*theDice.Select(i));
return total;
}and this is the error i am recieving DiceGameDice.cpp:18: error: syntax error before `::' token DiceGameDice.cpp:23: error: syntax error before `::' token DiceGameDice.cpp:27: error: syntax error before `::' token DiceGameDice.cpp:30: error: `dcount' was not declared in this scope DiceGameDice.cpp:30: error: parse error before `;' token DiceGameDice.cpp:30: error: syntax error before `++' token make: *** [DiceGameDice.o] Error 1 any help would be great. perferably tonight ![]()
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Sep 2004
Posts: 38
Rep Power: 0
![]() |
DiceGameDice::GetDiceValue is missing a closing '}'
Once you have an error invloving missing a scope closing you will get a huge number of meaningless errors - only that first one really points you at where the problem is. |
|
|
|
|
|
#3 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
Yup. Just that one closing brace is probably giving you all that.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#4 |
|
PFO Founder
![]() ![]() |
ok i added that and got the same error and then noticed i was missing a namespace
but here is my new error DiceGameDice.cpp: In constructor ` DiceGameDiceNameSpace::DiceGameDice::DiceGameDice()': DiceGameDice.cpp:19: error: parse error before `public' DiceGameDice.cpp: At global scope: DiceGameDice.cpp:30: error: no `int DiceGameDiceNameSpace::DiceGameDice::Total(DiceNameSpace::Dice)' member function declared in class `DiceGameDiceNameSpace::DiceGameDice' make: *** [DiceGameDice.o] Error 1
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#5 |
|
PFO Founder
![]() ![]() |
fixed everything
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() ![]() |
i always miss all of the fun
![]()
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#7 |
|
PFO Founder
![]() ![]() |
if your still around and will be for alittle while i mite have some more stuff i need help with. like what would be the way to make the system pause and state. "press any key to continue" in linux using c++
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#8 |
|
Programming Guru
![]() ![]() ![]() |
#include <stdlib.h>
system("PAUSE");
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#9 |
|
PFO Founder
![]() ![]() |
o and im having problems with my random number generator. both the user and the computer then the same dice on every roll no matter what. im thinking that some how its not actually re-rolling the dice. if you want i could post the code but not exactly sure what code i should post as i have 12 files of code lol
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#10 |
|
Programming Guru
![]() ![]() ![]() |
seed the random number generator with the time, and reseed it prior to each roll for both player and computer.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|