Write a program detab that replaces tabs in the input with the proper number
of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every n columns.
Should n be a variable or a symbolic parameter?
Write a program detab that replaces tabs in the input with the proper number
of blanks to space to the next tab stop. Assume a fixed set of tab stops, say every n columns.
Should n be a variable or a symbolic parameter?
Ok, lets approach this the smart way....
Sit down with pencil and paper, work out some of the possibilities and make sure you understand what can happen.
Then "become the problem"... what steps do you have to take to solve this problem.
Finally, "become the program"... what do you have to do to code your solution to the problem.
There is no programmer on this earth who can code the solution to a problem he doesn't understand.
However... a proper understanding of the problem almost always suggest a solution.
Give it your best shot, post your code... lets see what we can do...
I don't know the specifics of the question. If n comes from the user, then it has to be variable. If it doesn't, then you can use either or the other at your leisure. (This is the sort of thing that people have been arguing about for 30 years and they're not going to stop any time soon.)