Re: Problem with printing input.
- From: ramakrishnat@xxxxxxxxx
- Date: 20 Apr 2005 22:25:52 -0700
try execute this program ...
if input is this ...
hey you rama krishna
output:
hey
you
rama
krishna
is that what u want ?
#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;
}
.
- Follow-Ups:
- Re: Problem with printing input.
- From: Walter Roberson
- Re: Problem with printing input.
- References:
- Problem with printing input.
- From: Matt
- Problem with printing input.
- Prev by Date: Re: How to count CPU time by using C function
- Next by Date: Re: What all gcc does
- Previous by thread: Re: Problem with printing input.
- Next by thread: Re: Problem with printing input.
- Index(es):
Relevant Pages
|