1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
void ShieldTest ();
{
ShieldsUp = (Shields > 2); //if Shields are >=3 shields are up.
while (ShieldsUp == 1)
{
UpShields = "UP";
break;
}
while (ShieldsUp == 0) //if Shields are <3 shields are down
{
UpShields = "Down";
break;
}
}
|
Actually compiles, but doesn't do what you want :)
The first line has a trailing semicolon, so it says that a function named
ShieldTest
exists, and that it accepts no arguments.
The rest of the lines introduce a new local scope, not bound to any new function, which gets run first thing in main.
Take that entire snippet of code out of main. Functions cannot be defined inside other functions, although they can be
declared locally (to, e.g., change default arguments in the lexical scope). Then, remove the semicolon from the end of the first line.
Also:
int ShieldTest();
Can't have
int
in front of it for similar reasons. Function
calls don't need a return type in front of them; the compiler already knows (and that changes the meaning).