This program using Turbo C++ ..
#include <stdio.h>
#include <conio.h>
#include <string.h>
void freemenu();
void menu();
void customer();
void choice();
void receipt();
void free();
void bigbody ();
int back, quantity, oder, sodder, fcode, freecake;
float sum, total;
char select, name[40], phone[11], ordate[9], item[30], chker, buf[5] ;
float a=10, b=20, c=30, d=5, e=55, f=89, g=100, h=120;
void main()
{
bigbody(); //please refer to void bigbody() for full code
}
void freemenu()
// Free gift Menu Data
{
printf("\n---------------------------------------------------------------------------");
printf("\n100.cake \t\tKek Strawberi\t\t 50\t\t1kg");
printf("\n101.cake \t\tKek Pisang\t\t 40\t\t1kg");
printf("\n102.cake \t\tKek Durian\t\t 60\t\t1kg");
printf("\n103.cake \t\tKek Keledek\t\t 45\t\t1kg");
printf("\n---------------------------------------------------------------------------");
}
void menu ()
// Menu Data
{
clrscr();
printf("\n\t\t\t===================================\n");
printf("\t\t\t** \t Resepi Rahsio \t\t **\n");
printf("\t\t\t===================================\n\n");
// Menu
printf("\n---------------------------------------------------------------------------");
printf("\n\t\t\t\t Resepi Rahsio Corner ");
printf("\n\n category\t\tItem Name\t\t Price\t\tpcs/weight");
printf("\n1.cookies \t\tBiskut Merry Ba\t\t 10\t\t50pcs");
printf("\n2.cookies \t\tBiskut Tiger Go\t\t 20\t\t50pcs");
printf("\n3.cookies \t\tBiskut Korea\t\t 30\t\t50pcs");
printf("\n4.cookies \t\tBiskut Kering\t\t 5\t\t50pcs");
printf("\n5.cake \t\tKek Lapan Lapis\t\t 55\t\t1kg");
printf("\n6.cake \t\tKek Ice Blended\t\t 89\t\t1kg");
printf("\n7.cake \t\tKek Blueberry\t\t 100\t\t1kg");
printf("\n8.cake \t\tKek Arab\t\t 120\t\t1kg");
printf("\n---------------------------------------------------------------------------");
}
void customer ()
// Customer Data
{
printf("\n\nCustomer Name : ");
scanf("%s", &name);
printf(" \nPhone No : ");
scanf("%s",&phone);
printf(" \nOrder Date : ");
scanf("%s",&ordate);
printf("\n---------------------------------------------------------------------------");
}
void choice ()
// Choice of menu Data
{
printf(" \nMenu Choice : (1-8)");
scanf("%d",&oder);
printf("\n\nYour choice is :");
if(oder==1)
{
printf(" Biskut Merry Ba");
printf("\n Order Quantity:");
scanf("%d",&quantity);
sum=a * quantity;
printf(" Total RM %.2f",sum);
}
else if(oder==2)
{
printf(" Biskut Tiger Go");
printf("\nOrder Quantity:");
scanf("%d",&quantity);
sum=b * quantity;
printf(" Total RM %.2f",sum);
}
else if(oder==3)
{
printf(" Biskut Korea");
printf("\nOrder Quantity:");
scanf("%d",&quantity);
sum=c * quantity;
printf(" Total RM %.2f",sum);
}
else if(oder==4)
{
printf(" Biskut Kering");
printf("\nOrder Quantity:");
scanf("%d",&quantity);
sum=d * quantity;
printf(" Total RM %.2f",sum);
}
else if(oder==5)
{
printf(" Kek Lapan Lapis");
printf("\nOrder Quantity:");
scanf("%d",&quantity);
sum=e * quantity;
printf(" Total RM %.2f",sum);
}
else if(oder==6)
{
printf(" Kek Ice Blended");
printf("\nOrder Quantity:");
scanf("%d",&quantity);
sum=f * quantity;
printf(" Total RM %.2f",sum);
}
else if(oder==7)
{
printf("Kek Blueberry");
printf("\nOrder Quantity:");
scanf("%d",&quantity);
sum=g * quantity;
printf(" Total RM %.2f",sum);
}
else if(oder==8)
{
printf("Kek Arab");
printf("\nOrder Quantity:");
scanf("%d",&quantity);
sum=h * quantity;
printf(" Total RM %.2f",sum);
}
else
{
printf("\n Please select again");
choice();
}
}
void receipt ()
// Receipts Data
{
clrscr();
printf("\n---------------------------------------------------------------------------");
printf("\n\t\t\t\tResepi Rahsio ");
printf("\n Customer Name \t:\t");
puts (name);
printf(" Phone No \t: \t%s", phone);
printf("\n Order Date \t: \t%s", ordate);
printf("\n Menu Choice \t:\t");
if(oder==1)
{printf("Biskut Merry Ba");}
else if(oder==2)
{printf("Biskut Tiger Go");}
else if(oder==3)
{printf("Biskut Korea");}
else if(oder==4)
{printf("Biskut Kering");}
else if(oder==5)
{printf("Kek Lapan Lapis");}
else if(oder==6)
{printf("Kek Ice Blended");}
else if(oder==7)
{printf("Kek Blueberry");}
else if(oder==8)
{printf("Kek Arab");}
else
{}
printf("\n Quantity \t: \t%d",quantity);
printf("\n Total \t\t: \tRM %.2f\n",sum);
if (sum>100)
{
printf("\nYour free cake is ");
if (freecake==1)
{printf("Kek Strawberi");}
else if (freecake==2)
{printf("Kek Pisang");}
else if (freecake==3)
{printf("Kek Durian");}
else if (freecake==4)
{printf("Kek Keledek");}
else
{printf("");}
}
else
{}
printf("\n---------------------------------------------------------------------------");
}
void free()
// Free gift Data
{
freecake=0;
printf("\n\n Congratulation, You got a free Cake");
freemenu();
printf("\n\n Select your free cake : ");
scanf("%d",&fcode);
switch (fcode)
{
case 100 :
printf("\n Free cake : Kek Strawberi\n");
chker='n';
freecake= 1;
break;
case 101 :
printf("\n Free cake : Kek Pisang\n");
chker='n';
freecake= 2;
break;
case 102 :
printf("\n Free cake : Kek Durian\n");
chker='n';
freecake= 3;
break;
case 103 :
printf("\n Free cake : Kek Keledek\n");
chker='n';
freecake=4;
break;
default:
printf("\n Please select again\n");
chker='y';
break;
}
receipt();
}
void bigbody()
// The BigBody data is made to resemble the full flow of event
{
clrscr();
char answ;
menu();
customer();
choice();
printf("\n\nDo you want to edit your order");
printf("\nYes = Y \nNo = N\n" );
scanf("%s", &answ);
switch (answ)
{
case 'y':
menu ();
choice();
break;
case 'n':
break;
default:
printf("Please choose again");
}
if (sum>100)
{free();}
else
{receipt();}
printf("\n\n\tThank you for your order \t\tPlease come again");
getch();
bigbody();
}
No comments:
Post a Comment