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;

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;

Topic archived. No new replies allowed.