| emmaalexandra (1) | |
|
This is part of my code which finds the "shortest" length out of an array. It can find the minimum length and display it but i cant get it to display the index of the array that the minimum is referring to any help?? int m; shortest = Lengths[0]; for (m=0; m < numCorners; m++) { if (Lengths[m] < shortest) { shortest = Lengths[m]; } } cout << endl; cout << "The shortest length is << shortest << " which is length " << m << endl; | |
|
|
|
| L B (3806) | |
| Try storing the actual index of the shortest rather than the shortest itself. | |
|
|
|