Posted on 1998-01-11
After my last never ending question i have managed to suss out how to write the coding to find a file on a computer.
Now i have to write some coding which will re-write the messy coding of the program and put in the right amount of indentations after 'begins' and 'ends'.
my tutor has told us that we will not affect the amount of lines in the program we just have to take each line strip out any spaces at the begining of each line and then re-write it. But when we find a 'begin' we have to indent so many spaces and when we find an 'end' we have to go back the same amount of spaces so the program looks neat.
He reckons it involves an indentation variable which increments when the program finds a 'begin' and decrements when it finds an 'end' it also has another variable which is the amount of spaces to increment.(i think when the indent count goes up it is multiplied on the space amount so if there is a loop in a loop it doubles the spaces until it finds an 'end'). I think each line is stored in a string and the ASCI end of line code is used.
Any help you can give me will be much appreciated and save me from being put in an asylum.