Here is the planet class and constructor which randomly determines the planets status:
Here i have an instance of the planet classCode:class Planet { public: Planet(); enum { Ally, Governemnt, Neutral } Status; //USED TO DETERMINE THE PLANETS STATUS IN THE GAME private: }; Planet::Planet() { int RandomStatus = rand()%3; //RANDOMLY SETS THE STATUS OF THE PLANET switch(RandomStatus) { case 0: Status = Ally; break; case 1: Status = Governemnt; break; case 2: Status = Neutral; break; default: Status = Neutral; } }
and lastly I have a thing that tests the planet's status to make sure it works:Code:Planet *Planet1 = new Planet;
For some reason I get these errors:Code:char *AllyStatus = "The Planet is sided with the player"; char *GovtStatus = "The planet is sided with the goverment"; char *Neutral = "The planet is neutral"; while(!done) // Loop That Runs While done=FALSE { switch(Planet1->Status) { case Ally: TextOut(hDc, 0, 0, AllyStatus, sizeof(AllyStatus)); break; case Government: TextOut(hDc, 0, 0, GovernmentStatus, sizeof(GovernmentStatus)); break; case Neutral: TextOut(hDc, 0, 0, Neutral, sizeof(Neutral)); break; default: break; } ... ... ...
--------------------Configuration: lesson1 - Win32 Debug--------------------
Compiling...
Lesson1.cpp
C:\Documents and Settings\04thibaultc\Desktop\9 - 26 - 02 doens't compile\Lesson1.cpp(738) : error C2065: 'Ally' : undeclared identifier
C:\Documents and Settings\04thibaultc\Desktop\9 - 26 - 02 doens't compile\Lesson1.cpp(738) : error C2051: case expression not constant
C:\Documents and Settings\04thibaultc\Desktop\9 - 26 - 02 doens't compile\Lesson1.cpp(741) : error C2065: 'Government' : undeclared identifier
C:\Documents and Settings\04thibaultc\Desktop\9 - 26 - 02 doens't compile\Lesson1.cpp(741) : error C2051: case expression not constant
C:\Documents and Settings\04thibaultc\Desktop\9 - 26 - 02 doens't compile\Lesson1.cpp(742) : error C2065: 'GovernmentStatus' : undeclared identifier
C:\Documents and Settings\04thibaultc\Desktop\9 - 26 - 02 doens't compile\Lesson1.cpp(744) : error C2051: case expression not constant
C:\Documents and Settings\04thibaultc\Desktop\9 - 26 - 02 doens't compile\Lesson1.cpp(749) : warning C4065: switch statement contains 'default' but no 'case' labels
Error executing cl.exe.
lesson1.exe - 6 error(s), 1 warning(s)
That's a lot of errors! Ouch!



LinkBack URL
About LinkBacks



