Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- float getBun()
- {
- /* Chilli submarine-C
- Hotdog-D
- Swarma-S
- Burger-B*/
- char bun;
- float value;
- printf("Enter your prefed bun: ");
- scanf("%c", &bun);
- if ((bun = 'c') || (bun = 'C'))
- printf("Rs. each\n");
- else if ((bun = 'd') || ('D'))
- printf("Rs. each\n");
- else if ((bun = 's') || ('S'))
- printf("Rs. each\n");
- else if ((bun = 'b') || ('B'))
- printf("Rs. each\n");
- else
- printf("invalid code\n");
- return value;
- }
- int getQuantity()
- {
- int qty;
- printf("Enter your required quantity: ");
- scanf("%i", &qty);
- return qty;
- }
- float getDistence()
- {
- float dis;
- printf("Enter your distance to the store from your home in Km: ");
- scanf("%f", &dis);
- getchar();
- if (dis <= 1)
- printf("Your deleviary is free\n");
- else if (dis <= 4)
- printf("Your deleviary fee=100/=\n");
- else if (dis > 4)
- printf("Your deleviary fee=200/=\n");
- return dis;
- }
- int main()
- {
- float dis;
- int n = 0, m = 0;
- char answer;
- printf("Do you want to order another bun (Y/N): ");
- scanf("%c", &answer);
- if (n == 12)
- {
- printf("You reached the limit");
- dis = getDistence();
- }
- else
- {
- while (m < 1)
- {
- if (answer == 'n' || answer == 'N')
- {
- dis = getDistence();
- m++;
- }
- else if (answer == 'y' || answer == 'Y')
- {
- getchar();
- char _bun = getBun();
- getchar();
- int _qty = getQuantity();
- n++;
- getchar();
- printf("Do you want to order another bun (Y/N): ");
- scanf("%c", &answer);
- }
- else
- {
- printf("Wrong input!!\n");
- getchar();
- printf("Do you want to order another bun (Y/N): ");
- scanf("%c", &answer);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement