why are people giving him code? this is his homework!
On Dec 15, 2009, at 4:38 PM, py2akv wrote:
> Uday,
>
> With respect to others who already gave you good ideas, I'd like to show you
> my modest contribution.
>
> The string below is the worst case scenario with blanks at the beginning, at
> the middle and at the end, but the program works equally well with blanks at
> the sides only, at the middle, or any combination you like, even with no
> blanks at all.
>
> This outputs "C P L", nicer for the purists, not "C P L " (with an extra
> blank at the end) which requires less attention.
>
> char *str = " C Programming Language ";
> int f=0;
>
> while (*str) {
> if (*str!=' ')
> {printf(f ? " %c" : "%c", *str); f=1; while (*str && *++str!=' ');}
> else
> while (*++str==' ');
> }
>
> This outputs "C P L ".
>
> char *str = " C Programming Language ";
>
> while (*str) {
> if (*str!=' ')
> {printf("%c ", *str); while (*str && *++str!=' ');}
> else
> while (*++str==' ');
> }
>
> This is the same as the code above, but outputs "C P L" with the help of a
> little trick: printf("\b")/printf("%c", '\b').
>
> char *str = " C Programming Language ";
>
> while (*str) {
> if (*str!=' ')
> {printf("%c ", *str); while (*str && *++str!=' ');}
> else
> while (*++str==' ');
> }
> printf("\b");
>
> Best,
>
> Geraldo
>
> --- In [email protected], Uday Oberio <uday_obe...@...> wrote:
> >
> > hello everyone
> >
> > In C programming i want to solve one programm of string that is
> > Enter String is C Programming Language
> > Output is C P L.
> > means output is first letter of every word.how it can be possible .. please
> > help me
> > thanking you
> > with regards
> > Uday
> >
> >
> >
> > The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
> > http://in.yahoo.com/
> >
> > [Non-text portions of this message have been removed]
> >
>
>
[Non-text portions of this message have been removed]
------------------------------------
To unsubscribe, send a blank message to
<mailto:[email protected]>.Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/c-prog/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/