使用C标准库函数getchar(),getch()是boreland函数不是标准的函数。
仅用于Windows TURBO C.
printf("Let the Battle Begin!\n");
printf("Press Any Key to Continue\n");
getchar();
你应该按返回键这里。为此,printf语句应该按ENTER继续。
如果您按a,则再次按ENTER。
如果按ENTER键,它将继续正常。
因此,应该是
printf("Let the Battle Begin!\n");
printf("Press ENTER key to Continue\n");
getchar();
如果您使用的是Windows,那么可以使用getch()
printf("Let the Battle Begin!\n");
printf("Press Any Key to Continue\n");
getch();
//if you press any character it will continue ,
//but this is not a standard c function.
char ch;
printf("Let the Battle Begin!\n");
printf("Press ENTER key to Continue\n");
//here also if you press any other key will wait till pressing ENTER
scanf("%c",&ch); //works as getchar() but here extra variable is required.