The error should be pretty clear. It says the error is cannot resolve symbol, and it says the symbol is variable gcd, so it's saying cannot resolve variable gcd. IOW, you need to declare the variable gcd before you try to use it.

Has to do with the "scope" of the variable. Since you declared it inside a set of { } brackets, it is only visible from within that block of code. You need to declare it at the very top of your method, and then it'll be available in all parts of it.

As you can see I have two error check; one to test the correct number of arguments has been entered (this works fine), and on to test for a negative integer. The negative integer checl does not work for some reason although it does compile. It seems to loop infinitly. I cant exlicitly see anything wrong with the code however

Unfortunatly the brakects dont seem to have worked. I'm almost 100% certain I am entering the correct arguments. For example, I pass in 10 & 100 as two arguments, and expect the GCD to be 10; which I get. However if I pass in 100 and -10; the program seems to go one infinitly.

As I said before; all other error checks work - it's just this blighter!

[b][red]This message was edited by Manning at 2004-5-3 16:23:51[/red][/b][hr]: Unfortunatly the brakects dont seem to have worked. I'm almost 100% certain I am entering the correct arguments. For example, I pass in 10 & 100 as two arguments, and expect the GCD to be 10; which I get. However if I pass in 100 and -10; the program seems to go one infinitly.: : As I said before; all other error checks work - it's just this blighter!

Ahh I just took a closer look at the code. You have your error checking AFTER you call your gcdCalc() function. It needs to go before of course, otherwise it's kind of useless.