Greetings,
I did see a few errors that evidently caught my attention.
Firstly, on line 6 of your posted code you have the following:
Though 4 lines later, [or line 10], you state the following:
for( int side1 = 0; side1 <= 500; side1++ )
What this is doing is creating an integer called side1, which may cause errors since you already defined an integer of the same name on line 6. The same goes for
side2 and
hypotenuse. Since the variable already exists, the for loop shouldn't contain the
int data type.
Also, in your calculation of checking if the
two sides equal the hypotenuse will always pass since asking if a variable
equal or
equals is different. See why:
if (a = b) { b = a; } // will not ensure a equals b (why, because you are setting a to b not checking for comparing)
if (a == b) { b = a; } // this ensures a equals b using ==
Likewise with your following statement if this makes sense:
if( ( side1 * side1 ) + ( side2 * side2 ) = ( hypotenuse * hypotenuse ) )
Other than that, I haven't tried to compile your code, and do not know where the C2106 error lies within.
I hope this helps,
-
Stack
Overflow