The 2nd time ur reading the enter u gave the first time.
And u could have used while to do that.

----------------------------------
Peace and love,
Tweety
[EMAIL PROTECTED] - [EMAIL PROTECTED]
YahooID: tweety_04_01

> -----Original Message-----
> From: Kinga Kulesza [mailto:[EMAIL PROTECTED]
> Sent: Saturday, October 23, 2004 8:35 PM
> To: [EMAIL PROTECTED]
> Subject: [c-prog] Novice question - Continue (Y/N)
>
>
> Hi guys!
>
> I'm totaly new in this group and I'm fresh in C as
> well.
> I have just started C (not C++) and would like to know
> what is the simplest and most efficient way of asking
> the user if he wants to continue (repeat) program or
> simply exit. I have writen (you will laugh) code using
> ineficient goto statement.
> It seems like goto goes to label end executes only
> first encoutered statement. Here is what I came up
> with. Thanks for any feedback.
>
> regards
> Kinga
> -----------------------------------------------------
> #include<stdio.h>
> main()
> {
> int c;
> program:
>
> printf("Do you want to test this program? (y/n) \n");
> c=getchar();
> if (c==121)
>
> {
> printf("THANKS for testing me!!\n");
> goto program;
> }
>
>
> else
> printf("GOODBYE \n");
> }
>
>
>
>
>
>
>
>            
> _______________________________
> Do you Yahoo!?
> Express yourself with Y! Messenger! Free. Download now.
> http://messenger.yahoo.com
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
> Now with Pop-Up Blocker. Get it for free!
> http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/EbFolB/TM
> --------------------------------------------------------------
> ------~->
>
> To unsubscribe, send a blank message to
> <mailto:[EMAIL PROTECTED]>.
> Yahoo! Groups Links
>
>
>

>
>
>
>




To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=294855.5468653.6549235.3001176/D=groups/S=:HM/A=2376776/rand=350611573


Yahoo! Groups Links

Reply via email to