คือเราเขียนโค้ดแล้วมันรันได้ แต่พอเราใส่ตัวเลขเลือกตรง choice มันไม่ขึ้นหน้านั้นๆ แต่ดันออกจากหน้าที่รันเลย ควรแก้ยังไงดีคะ นี่โค้ดค่ะ🙏🙏🙏
#include<stdio.h>
#include<conio.h>
void main()
{
int choice,choice2;
clrscr();
loop1:
printf("\n\t Program Finding area \n");
printf("\t1.Find Circle,Circleference,Diameter\n");
printf("\t2.Program producer\n");
printf("\t3.Exit\n");
printf("\t++++++++++++++++++++++++++++++++++++++++++++\n");
printf("\n\t choice :");
scanf("%d",&choice);
switch(choice)
{
case1:
float pi=3.1415;
float radius,circle,circumference,diameter;
printf("Input number radius===>");
scanf("%f",&radius);
circle=pi*radius*radius;
diameter=2*radius;
printf("\ncircle=%f",circle);
printf("\ncircumference=%f",circumference);
printf("\ndiameter=%f",diameter);
getch();
goto loop1;
case2:
printf("\n\tProgram producer\n");
printf("\tThanaporn Assawadakorn M.6/5 No.31\n");
getch();
goto loop1;
case3:
break;
// default:
}
getch();
}
ช่วยแก้โค้ด Turboc++ หน่อยคะTT
#include<stdio.h>
#include<conio.h>
void main()
{
int choice,choice2;
clrscr();
loop1:
printf("\n\t Program Finding area \n");
printf("\t1.Find Circle,Circleference,Diameter\n");
printf("\t2.Program producer\n");
printf("\t3.Exit\n");
printf("\t++++++++++++++++++++++++++++++++++++++++++++\n");
printf("\n\t choice :");
scanf("%d",&choice);
switch(choice)
{
case1:
float pi=3.1415;
float radius,circle,circumference,diameter;
printf("Input number radius===>");
scanf("%f",&radius);
circle=pi*radius*radius;
diameter=2*radius;
printf("\ncircle=%f",circle);
printf("\ncircumference=%f",circumference);
printf("\ndiameter=%f",diameter);
getch();
goto loop1;
case2:
printf("\n\tProgram producer\n");
printf("\tThanaporn Assawadakorn M.6/5 No.31\n");
getch();
goto loop1;
case3:
break;
// default:
}
getch();
}