Re: need help



entilzah wrote:
I am in a Pascal programming class, my problem is I am writing a
program that adds numbers together and then tracks positives
entered,negatives entered, and zeroes entered then gives a total of all
three and displays each. This part I have working with no problem,
even have the terminal value of 9999 working. What I do not get is how
to track consecutive repeat numbers entered and display the number
repeated the most times in a row. Please help.

To recognize that the number entered this time is the same as the number entered last time, you'll need a variable for holding what the previous number was. Each time you get a new number, you'll also need to update the "previous" number.

You might also need a variable or variables for remembering what the current run of numbers is -- which number is being repeated, and how many times has it been repeated?

Each time through your loop, compare the current run of numbers with the most recent record. If the current run exceeds the length of the previous run, then update the previous run.

Does that make things any clearer for you?

--
Rob
.



Relevant Pages

  • Re: What will you watch?
    ... Those who do not remember the lessons of history are doomed to repeat ... There's a difference between remembering it and wallowing in it. ...
    (rec.arts.tv)
  • Re: What will you watch?
    ... Those who do not remember the lessons of history are doomed to repeat it. ... There's a difference between remembering it and wallowing in it. ...
    (rec.arts.tv)