void booking() { //globally declared function
printf("please select the seats");
printf("1A 2A 3A G");
}
int main() { //Main function
int n;
clrscr();
printf("\t\t\t Railway reservation system");
printf("1.Booking");
printf("2.Availability checking");
printf("3.Cancellation");
printf("4.Prpare chart");
scanf("%d",&n);
switch(n) //when I give input as 1 switch case is not being executed
{
case 1:
booking(); //after the input it should execute this global function.
break;
case 2:
break;
case 3:
break;
case 4:
break;
}
return n;
}
我的目标是当我们给出输入 n 时,它应该执行全局声明的函数。输入后它不会进入 switch 语句。
地方
printf("Press any key to exit...");
while (!kbhit()) ;
在return
声明之前,您将在关闭之前看到控制台屏幕。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句