Answer to Question #259435 in C for fas

Question #259435

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.


1
Expert's answer
2021-11-01T18:51:16-0400
#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");
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS