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
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
