Re: I don't quite understand this exercise...
- From: Roberto Waltman <usenet@xxxxxxxxxxxx>
- Date: Mon, 26 Sep 2005 15:58:27 -0400
"Patrick M." wrote:
>Ok, thanks, and everyone else. So what you're saying is, they want me to
>ask the user/get and set a variable, say n, and replace all tabs with n
>spaces, and they don't want me to calculate the number of spaces a tab
>takes up on the system?
>
Almost there... They are asking for a program that will take as input:
(a) A text file containing some tab characters. And
(b) A number 'N' telling what is the tab "spacing"
And produce, as output, a text file where every tab has been replaced
by a *variable* number of spaces between 1 and N so that the file
"looks" similar to the original when displayed or printed in a device
that uses 'N' colums per tab.
For example, if N is 4 and the original file is:
int i = 0;
int jj = 0;
int kkk = 0;
Containing a tab before each 'int', a space after each 'int' and a tab
before each '=', the output should be:
int i = 0;
int jj = 0;
int kkk = 0;
containing 4 spaces before each int, one space after each int, 3
spaces after 'i', 2 spaces after 'jj' and 1 space after 'kkk';
Roberto Waltman
[ Please reply to the group, ]
[ return address is invalid. ]
.
- References:
- I don't quite understand this exercise...
- From: Patrick M.
- Re: I don't quite understand this exercise...
- From: Thad Smith
- Re: I don't quite understand this exercise...
- From: Patrick M.
- I don't quite understand this exercise...
- Prev by Date: Re: Count Words
- Next by Date: Re: visibility of variable
- Previous by thread: Re: I don't quite understand this exercise...
- Next by thread: itoa, atoi - confused
- Index(es):
Relevant Pages
|