Created
May 25, 2019 14:00
-
-
Save LukeDavitt/4a8f19ce2b58424319ac09502661efe4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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