Re: Problem with printing input.
- From: ramakrishnat@xxxxxxxxx
- Date: 21 Apr 2005 03:50:56 -0700
this program assumes that the words in a line are separated only by one
space.
but writing a program that handles variable number of spaces is a
breeze once u know the basic logic.
Walter Roberson wrote:
> In article <1114061152.442467.165550@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
> <ramakrishnat@xxxxxxxxx> wrote:
> >try execute this program ...
>
> >#include <stdio.h>
>
> >/* print the input one word per time on different lines */
>
> >int main(void)
> >{
> > int c;
> > while ((c = getchar()) != EOF) {
> > if (c == ' ' || c == '\n' || c == '\t')
> > putchar('\n');
> > else
> > putchar(c);
> > }
> > return 0;
> >}
>
> And if the input is
>
> hey you rama krishna
>
> is your program going to print one word per line?
> --
> "Never install telephone wiring during a lightning storm." --
Linksys
.
- Follow-Ups:
- Re: Problem with printing input.
- From: ramakrishnat
- Re: Problem with printing input.
- References:
- Problem with printing input.
- From: Matt
- Re: Problem with printing input.
- From: ramakrishnat
- Re: Problem with printing input.
- From: Walter Roberson
- Problem with printing input.
- Prev by Date: Re: Dynamic Array
- Next by Date: Re: Problem with printing input.
- Previous by thread: Re: Problem with printing input.
- Next by thread: Re: Problem with printing input.
- Index(es):
Relevant Pages
|