for (int index = 0; index < 200; index++)
    {
        if(find_array[index] < minimums[0])
        {
            minimums[0] = find_array[index]; //Lowest number
            cout <<"The index is " << index << endl; // trying to find an index
        }
    }

    for (int index = 0; index < 200; index++)
    {
        if(find_array[index] < minimums[1] && find_array[index] > minimums[0])
        {
            minimums[1] = find_array[index]; //The NEXT Lowest number
            cout <<"The index is " << index << endl; // trying to find an index

        }


    }

I am trying to find the index of the smallest number.... Everything is fine but I couldnt find the index of it?

Recommended Answers

All 3 Replies

What exactly is your task ...? Have a vector of numbers and sort them or?

for example: The random number make 1 ..... 29.......34 .... 32..... 2...3......5......6: My code will print out: The smallest is 1 and this number locate at ???? and my 2nd smallest is at 2 and this number locate at ?????

i need index of the array

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.