Hi!
I'm trying to find min variance (both value and index).

I have x# of product defects tracked over y# of days.

prod1 prod2 prod3...
Day1: 1 1 1
Day2: 1 2 2
I have arrays that store max & min defects, by product#.


minVar = maxDefect[]-minDefect[] gives me the min value. But try as I might, I can't figure out how to deterine the index #. minVar is the value. minVarProd is supposed to be the index.

The output needs to read:

The product with a minimum variance of _x_ is product _y_.
I can get the x but the y is lost on me. Pertinent code follows...

Thank you much in advance!

minVar = maxDefect[p] - minDefect [p];  //Calc & update minVar[]
         minVarProd = p;

You can either loop through each column looking for the day with the minVar for that column, store each minVar in another array, and then search the array of minVar for the desired value when desired, OR you can compare the desired minVar value with the minVar of each column when you do the search for the minVar of each column and print out the desored values as you go.

Thank you very much for all y'all's help! I couldn't have completed this assignment without your help!

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.