Re: Your initialization of highest and lowest is incorrect
Laanan Fisher (no login) Posted Aug 27, 2007 4:25 PM
Gary's original code only kept the min/max values of the individual dates/numbers read from the file,
41 S = N1 + N2 + N3
58 IF S < S1 THEN S1 = S ' (Determines if the sum is the lowest)
59 IF S > S2 THEN S2 = S ' (Determines if the sum is the highest)
not the min/max of the array elements (which I incorrectly misread as totals, not as counters like his original code, my version should increment the array elements not add *currentsum*, sorry Gary). I'm still not sure exactly what this program is supposed to do, but your suggestion and my mistake result in different behavior of the original code. You make a good observation, though, but it all depends on what min/max you're actually looking for.
In any case, a check on sumcount should be added to my version to see if any dates/numbers were actually read from the file in order to interpret lowestsum and highestsum correctly - perhaps by displaying "N/A" if no dates/numbers were read.