0

Hello. First of all, sorry for making the other thread before looking more deeply. I did not make this mistake this time, though.

I have a really odd error. I have no idea what might cause it. Here's the error (Gives me two of these).

\main.cpp(74) : error C2143: syntax error : missing ';' before ')'
\main.cpp(74) : error C2143: syntax error : missing ';' before ')'

Line 74 in my source code is this.

for (PlayerStamina = 50) {

And the "full" local code is this.

case 2:
				if (PlayerStamina < 40 || PlayerStamina > 35) {
			        	for (PlayerStamina = 50) {
						cout << "You try to block the enemy, but fail." << endl;
						DamagePlayer();
						PlayerStamina++; } }
				else if (PlayerStamina < 20 || PlayerStamina > 30) {
					cout << "You try to block the enemy, but fail." << endl;
					DamagePlayer();
					GivePlayerStamina(); }
				break;

I'm running out of ideas here... I'd really like any kind of help.

3
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by vibs123
Featured Replies
  • 1

    A few things are wrong with your code: [icode]if (PlayerStamina < 40 || PlayerStamina > 35) {[/icode] You're saying : [icode]if PlayerStamina is smaller then 40 or bigger then 35[/icode].. Read this line very carefully and then tell me ONE number that isn't smaller then 40 or bigger then 35 … Read More

1

A few things are wrong with your code: if (PlayerStamina < 40 || PlayerStamina > 35) { You're saying : if PlayerStamina is smaller then 40 or bigger then 35 .. Read this line very carefully and then tell me ONE number that isn't smaller then 40 or bigger then 35 :)


What are you trying to do here: for (PlayerStamina = 50) { ??


that doesn't make sense at all. Here's a tutorial on loops.

Comments
Helped me on C++
0

Ah, thanks there, niek_e. +rep!

You're right about the first part. I tried to create a failsafe there, but I guess I failed. And about the PlayerStamina = 50 part, if I tried to put PlayerStamina > 50 I would've got an error.

I tried While instead of For, and it compiled fine. Now, I hope no bugs show up "in game", haha.

I can mark this as solved now.
metalclunch

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.