need help to fix this simple code

 
Hi. Am just learning to program and i have seen great materials from this forum that really assist me. However the MQL4 book gave an example and the code will give error when i try to compile it. Can anyone pls help me locate where the problem is. Thanks for this and the other issues i will be bringing here anytime i get hook. i attached the code in this msg
Files:
code.txt  1 kb
 

Your code compiles just fine.


Note that the return of MathSqrt() is double and u r passing it to int so the result will be type-casted. In this case (since the result is 5.0) it makes no difference, but in other cases type-casting from double to int will result in the fractional part to be truncated.


In the future:


 
gordon:

Your code compiles just fine.


Note that the return of MathSqrt() is double and u r passing it to int so the result will be type-casted. In this case (since the result is 5.0) it makes no difference, but in other cases type-casting from double to int will result in the fractional part to be truncated.


In the future:


Hey Gordon. Thanks for ur response really appreciate it. But still trying to compile this code and it gives me error that 'c' variable not defined. Dont know what i did wrong. Really sorry to bother you. Thanks

 
afo3:

Hey Gordon. Thanks for ur response really appreciate it. But still trying to compile this code and it gives me error that 'c' variable not defined. Dont know what i did wrong. Really sorry to bother you. Thanks

Are us sure the code u r trying to compile is EXACTLY the same as in your attachment? The attachment compiles fine. There is no problem with the c variable.

 
gordon:

Are us sure the code u r trying to compile is EXACTLY the same as in your attachment? The attachment compiles fine. There is no problem with the c variable.

Thanks gordon. The mistake i made is i dint put int c_2 = a*a + b*b in

 
Thanks gordon. The mistake i made is that i dint put the operation of int c_2 in bracket (i.e a*a + b*b) and so it dint compile. Thanks again.
Reason: