So I have been looking at a C program code for the below coding, need to get output but unable to get it
#include <stdio.h>
#include <stdlib.h>
void instructions(){
system("cls");
printf("Instructions");
printf("\n----------------");
printf("\n Avoid Cars by moving left or right. ");
printf("\n\n Press 'a' to move left");
printf("\n Press 'd' to move right");
printf("\n Press 'Esc' to exit");
printf("\n\n Press any key to go back to menu");
getch();
}
int main()
{
system("cls");
printf("--------------------------\n");
printf(" Car game \n");
printf("--------------------------\n");
printf("1. Start game\n");
printf("2. Instructions\n");
printf("3. Quit\n");
printf("Select Option: \n");
scanf("%d");
char op = getche();
if( op=='1') //play();
else if ( op=='2' instructions();
else if( op=='3') //exit(0);
while(1);
return 0;
}
Aucun commentaire:
Enregistrer un commentaire