Skip to content

Instantly share code, notes, and snippets.

@LukeDavitt
Created May 25, 2019 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LukeDavitt/4a8f19ce2b58424319ac09502661efe4 to your computer and use it in GitHub Desktop.
Save LukeDavitt/4a8f19ce2b58424319ac09502661efe4 to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main()
{
char str[10];
ready: do{
printf("\nMachine is READY. (D)eposit or (Q)uit :");
scanf("%s",str);
}while(!(str[0]!='D'||str[0]!='d'||str[0]!='q'||str[0]!='Q'));
if(str[0]=='q'||str[0]=='Q')
goto quit;
goto waiting;
waiting: do{
printf("(S)elect product or choose to (R)efund :");
scanf("%s",str);
}while(!(str[0]!='s'||str[0]!='S'||str[0]!='r'||str[0]!='R'));
if(str[0]=='s'||str[0]=='S'){
printf("Dispensing product...");
goto dispense;
}
else{
printf("Please collect refund.");
goto ready;
}
dispense: do{
printf("\nPlease (C)ollect product. :");
scanf("%s",str);
}while(!(str[0]!='c'||str[0]!='C'));
goto ready;
quit: printf("Thank you, shutting down now.");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment