in reply to Re^2: Next Line Assigning to A Scalar
in thread Next Line Assigning to A Scalar

So implement the algorithm as follows:

  1. Read the first line. Print it. Store its values.
  2. Read the second line. Print it if it matches the first line that you stored. Now replace your stored line with the second line.
  3. Read the third line. Print it if it matches your stored line. Store the line.
  4. Read the fourth line. Print it if it matches your stored line. Store the line.
  5. Read the fifthe line. Print it if it matches your stored line. Store the line.
  6. Read the sixth line. Print it if it matches your stored line. Store the line.
  7. Read the seventh line. Print it if it matches your stored line. Store the line.
  8. Continue these steps again and again until out of lines.

Each time you are storing the current line so that on the next iteration you can refer back to it. Whenever you store the current line, it replaces the line you previously stored.

You still haven't taken the time to show us sample output that the program would produce with specific sample input. Anyway, get started implementing the algorithm I've described, and let us know when you're stuck.


Dave