I keep getting a parse error for line 146. It says before '}' which is the end of a do loop... please help i've tried everything.
Printable View
I keep getting a parse error for line 146. It says before '}' which is the end of a do loop... please help i've tried everything.
You probably forgot a semicolon. Post your code so we can help more.
It's line 146.. parss error before '}'
I would post the code but I couldn't find the code tag.
You aren't using a do loop properly. The proper way to use it is:
Code:do
{
Code to loop through...
} while ( Condition );
Thanks allot, I don't know why I missed it. I eaven mensioned the } was the end of a do-loop. It just went right over my head ,oh well.
Here's the new source.. I still have lots of things to work out( choice 4, I'm using too many variabls) Mainly because this came from a previous allmost idintical game. But I realized to get more then two players would be hard the way I was doing it. So I came up with thit from the existing code.
its the number ( # ) symbol next to php and imgQuote:
I would post the code but I couldn't find the code tag.
I've often thought it would help to change that to "CODE" instead...
Edit: Looking briefly through your code, I see at least one thing that could be done better. I don't see why you need to make x=q, when you could just use q.
Code:int q=0;
//int x; <--declare it in a loop
cin>>q;
//x=q; <--die!
do
{
float pq[x];
/*
etc...
*/
for (int x=0;x<q;x++)
{
pa[x] = 0;
/*
etc.
*/
}
Thanks, as I said before this code came frome some of my preveous code and I havn't weeded everything out.
I updatd the code 2 posts above.
I've found a new problem thoe. The iner most do-loop should... continue while 2 or more players have more then 2 states.
Code:do
{
system("CLS");
for (x=0;x<q;x++)
{
r1= 1+rand() %5;
...
} while(1)//somehow while >1players has>0 states
im thinking something along the lines of having a state class. it could have a variable named "ownedBy" or something, and then have like:
anyways i have to eat now, maybe ill add more laterCode:enum OWNER { PLAYER1, PLAYER2, PLAYER3 };
class state
{
...
private:
OWNER whatever;
};
I can't do any modifications to the source because my computer I programm with got water in it.. :confused: I live on a hill but water came in the walls. I'm posting with my dad's computer right now, and he dosn't want anything installed or downloaded.
Anyhow it just needs to dry out another 3-5 days and if it dosn't work my hardrive should be fine. If not I'll just download the source I posted :D. Anyhow I'm going to be gone for till next saturday.