Bakery management prototype using c
#include <stdio.h>
#include <string.h>
int main() {
char ITEM1[] = "cake";
char ITEM2[] = "bread";
char ITEM3[] = "icecream";
char userInput[50];
int Quantity, price, total_cost;
while (1) {
printf("Items Available:\tprice: \n 1.cake--------\t\t15\n2.bread--------\t\t20\n3.icecream--------\t10 \n");
printf("________________________________________");
printf("Place your Order:\n");
scanf("%s", userInput);
printf("________________________________________");
if (strcmp(userInput, ITEM1) == 0) {
price = 15;
} else if (strcmp(userInput, ITEM2) == 0) {
price = 20;
} else if (strcmp(userInput, ITEM3) == 0) {
price = 10;
} else {
printf("Invalid Input.\n Try Again.\n");
continue;
}
printf("how many %s do you want: ", userInput);
scanf("%d", &Quantity);
total_cost = Quantity * price;
printf("your order is :\n");
printf("Item:\t %s =\t%d\n", userInput, Quantity);
printf("________________________________________");
printf("Your Total cost is %d\n", total_cost);
printf("________________________________________");
printf("your Order will be delivered in 30 mins\n Thank you\n");
printf("________________________________________");
break;
}
return 0;
}
Comments
Post a Comment