however, when I try to write write the following in c++, the code doesnt seem to work: bool check(){
if (sides[0] < (sides[1]+sides[2]))
return true;
else
return false;
}
what am i doing wrong? how would i do this in c++.
thanks in advance!
If 'sides' is not declared as a global array, you'll get a compiler error. At first glance, I'd say that Java function was poorly written to begin with. 'sides' shouldn't be a global.
I'd rewrite the signature to this: bool check(/*int?*/ *sides)
(In C/++, T *array and T array[] are equivalent for declarations.)