MorphuisOGrady
Member
Hi Guys,
I have attached my attempt at a problem I cant seem to get my head around.
Basically I need to loop through an array of objects and determine which one has the least amount of turn offs and set a flag accordingly.
The peudsocode as I see it is as follows:
1. Get first value and store it as minimum value.
2. Get second number and compare it with minimum value
3. If second number is smaller make it the samllest number and proceed like this.
The only way I can see it working is if i initilise the loop to start at 1. This works fine and the flags are set but the code never process the first object, i.e EM_Starter[0]. Eventually this one will contain the least amount.
The next problem I have is if all the turnoffs are the same value then nothing will happen. This will happen eventually.What i need to happen is to set a Min_Flag of the first one if this occurs.
Would really appreciate if someone could take my attached code and give me some pointers. Am I even going about this in the right way even?
Thanks
I have attached my attempt at a problem I cant seem to get my head around.
Basically I need to loop through an array of objects and determine which one has the least amount of turn offs and set a flag accordingly.
The peudsocode as I see it is as follows:
1. Get first value and store it as minimum value.
2. Get second number and compare it with minimum value
3. If second number is smaller make it the samllest number and proceed like this.
The only way I can see it working is if i initilise the loop to start at 1. This works fine and the flags are set but the code never process the first object, i.e EM_Starter[0]. Eventually this one will contain the least amount.
The next problem I have is if all the turnoffs are the same value then nothing will happen. This will happen eventually.What i need to happen is to set a Min_Flag of the first one if this occurs.
Would really appreciate if someone could take my attached code and give me some pointers. Am I even going about this in the right way even?
Thanks