As many of the students like chats, chips, juice and chocolates, a vending machine is kept at several places. The person after putting the cash has to enter the product code so as to get it.
The code is as follows
Code Product
106 Haldiram Ratmali Sev
206 Haldiram Instant Bhel
306 Fuse Chocolate
406 Mixed Fruit Juice
506 Lassi
Depending on the code entered the item will be selected and given to the person who feeds the amount. An application has to be developed so that it automatically works after entering the code.
#include <stdio.h>
#define TRUE 1
#define FALSE 0
void print_menu();
int main() {
int flag = TRUE;
while ( flag ) {
int n;
scanf("%d", &n);
switch( n ) {
case 106:
//impl
break;
case 206:
//impl
break;
case 306:
//impl
break;
case 406:
//impl
break;
case 506:
//impl
break;
}
}
return 0;
}
void print_menu() {
printf("Code Product");
printf("106 Haldiram Ratmali Sev");
printf("206 Haldiram Instant Bhel");
printf("306 Fuse Chocolate");
printf("406 Mixed Fruit Juice");
printf("506 Lassi");
}
Comments
Leave a comment