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.

Recommended Answers

All 3 Replies

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.

commented: Helped me on C++ +1

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

instead of
for (PlayerStamina = 50) {
write:
if (PlayerStamina==50) {

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.