السلام عليكــم ورحمـة الله وبركاتــة
عندي استفسار عن كيفية استخدام دالة goto لأني ابي البرنامج يعيد نفسه اذا ادخل المستخدم قيمة 1 للمتغير a في اول البرنامج
#include <stdio.h>
main ()
{
again; /*I want to come back here and do the code again*/
int a;
printf "do you want have FUN ? you are in step 1\n";
printf "please type 1 for yes or 2 for no\n";
scanf ("%d", a);
if (a=1)
{
int b;
printf "do you want a quick fun? you are in step 2\n";
printf "please type 1 for yes or 2 for no\n";
scanf ("%d", b);
if (b=1)
{printf "you like having fun quickly. you are in step 4\n";
}
else
{
int c;
printf "ok,do you like have fun with people or alone? you are in step 3\n";
printf "please type 1 for with people or 2 for alone\n";
scan ("%d",c);
if (c=1)
{
printf "you have chosen the good choice, you are in step 5\n";
}
else
{
printf "why you like have fun alone? you are in step 6\n";
}
printf " having fun with people is better. you are in step 7\n";
}
printf "OK, take some FUN and enjoy : ) , you are in step 8\n";
if (a=1) then goto again; /* I want to go back to the first point in this program when a=1 */
}
printf "ok, the program finish, you are in step 9";
}وشكرا