exercise 1-20 K&R
- From: "Aenima1891" <aenima1891@xxxxxxxxxx>
- Date: 10 Jun 2006 09:13:32 -0700
write a program that replaces strings of blanks by the minimum number
of blanks to space to the next tab stop.
#include <stdio.h>
#define TABSIZE 8
int main()
{
int counter, c;
while ((c = getchar()) != EOF) {
if (c == '\t') {
for (counter = 1; counter <= TABSIZE; ++counter)
putchar(' ');
}
else
putchar(c);
}
return 0;
}
what do you think about this??
.
- Follow-Ups:
- Re: exercise 1-20 K&R
- From: Michael Mair
- Re: exercise 1-20 K&R
- From: Robert Gamble
- Re: exercise 1-20 K&R
- Prev by Date: Re: rand in a closed interval on the ints
- Next by Date: assignment from incompatible pointer type
- Previous by thread: how to iterate through all members in a struct
- Next by thread: Re: exercise 1-20 K&R
- Index(es):
Relevant Pages
|