A program for Tea Shop
Source Code:
//a program for tea shop...
#include<stdio.h>
#include<conio.h>
main()
{
printf("Welcome to Tea Shop software by Habib...\nver. 2.0.0.1\n\n");
lev1:
printf("");
float teapcup=15, coffepcup=20, coldp=30, sum;
int teacup=0, coffecup=0, coldcup=0, inp1;
char fname[15], lname[15], mbl[15], address[30];
printf("Enter customer's First name: ");
scanf("%s", &fname);
printf("Enter customer's last name: ");
scanf("%s", &lname);
printf("Enter customer's Adress: ");
scanf("%s", &address);
printf("Enter customer's contact number: ");
scanf("%s", &mbl);
lev2:
printf("\n1. coffe\n2. Tea\n3.Cold Drinks\n4.Sum\nEnter: ");
scanf("%d", &inp1);
switch(inp1)
{
case 1:
printf("How many cup: ");
scanf("%d", &coffecup);
goto lev2;
break;
case 2:
printf("How many cup: ");
scanf("%d", &teacup);
goto lev2;
break;
case 3:
printf("How many: ");
scanf("%d", &coldcup);
goto lev2;
break;
case 4:
system("cls");
sum=(teacup*teapcup)+(coffecup*coffepcup)+(coldcup*coldp);
printf("Omuk Tea Shop...\n");
printf("------------------------------------------------------\n");
printf("Customer Name: %s %s", fname, lname);
printf("\nAdress: %s", address);
printf("\nContact No.: %s", mbl);
printf("\n----------------------------------------------------");
printf("\nElement\t\tPer Cup\t\tCup\tTotal");
printf("\n-------\t\t-------\t\t---\t-----");
printf("\nTea\t\t%.2f\t\t%d\t%.2f", teapcup, teacup, teacup*teapcup);
printf("\nCoffe\t\t%.2f\t\t%d\t%.2f", coffepcup, coffecup, coffecup*coffepcup);
printf("\nDrinks\t\t%.2f\t\t%d\t%.2f", coldp, coldcup, coldcup*coldp );
printf("\n---------------------------------------------------");
printf("\n\t\t\t\tTotal: %.2f\n\n", sum);
getch();
system("cls");
getch();
goto lev1;
break;
default:
printf("\nError.\n");
goto lev2;
break;
}
}
Output:
|
Input |
|
Output |
No comments:
Post a Comment
পোস্ট সম্পর্কে মতামত দিন