I have the distance[] array declared globally, and xco and yco declared and initialised in the method. I also have locationx[] and locationy[] arrays declared globally, initialised with 7 integers in each.
for(int i = 0; i < 6; i++);
{
distance[i] = ((xco - locationx[i])*(xco - locationx[i])) + ((yco - locationy[i])*(yco - locationy[i]));
}
I've figured out that there must be a problem with this code, as when I try and display the contents of the distance[] array in the paint() method it shows the first six elements of the array as being 0 and only the last one with an actual number. What have I done wrong/what could the problem be?
(this code is in the mouseClicked() method).
2007-03-11
05:34:41
·
5 answers
·
asked by
roslya
1
in
Computers & Internet
➔ Programming & Design
The first answer looks like it might be somewhat helpful, if I could actually understand it properly. Could someone tell me what he's trying to say?
2007-03-11
05:47:47 ·
update #1