The QBasic / QB64 Discussion Forum      Other Subforums, Links and Downloads
 
Respond to this messageReturn to Index
Original Message
  • 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.
    Login Status
  • You are not logged in
    • Login
      Password
       

      Optional
      Provides additional benefits such as notifications, signatures, and user authentication.


      Create Account
    Your Name
    Your Email
    (Optional)
    Message Title
    Message Text
    Options Also send responses to my email address
          


    Newbies usually go to www.qbasic.com and click on The QBasic Forum
    Forum regulars have their own ways, which include The QBasic Community Forums