Вы находитесь на странице: 1из 4

#include<iostream.

h>
#include<string.h>
#include<conio.h>
#include<stdio.h>
#include<dos.h>
#include<process.h>
struct dat {
int dd,mm,yy;
};
struct sales {
char it_code[5],it_name[20];
float it_rate;
};
struct customer {
int memo;
char i_code[5];
char i_name[20];
float quantity;
float rate;
};
sales s[30];
customer c[30];
void order(void);
void bill(void);
void address(void);
char ans;
int i,ch,n,m,p; char u,mpsd[4];
void main()
{ char psd[4];

{clrscr();
gotoxy(33,13);
cout<<"JK SUPER MARKET";
for(i=10;i<=15;++i)
{gotoxy(30,i);
delay(100);
cout<<"*";
}
for(i=30;i<=51;++i)
{gotoxy(i,15);
delay(100);
cout<<"*";
}
for(i=10;i<=15;++i)
{gotoxy(35,i);
delay(100);
cout<<"*";
}
for(i=30;i<=51;++i)
{gotoxy(i,10);
delay(100);
cout<<"*";
}

gotoxy(20,20);
cout<<"\nThe shop is empty now please add some products";
{char ans;
int i=0;
ans='y';
do
{clrscr();
gotoxy(20,6);
cout<<"Name of the item=>";
cin>>s[i].it_name;
gotoxy(20,8);
cout<<"CODE OF THE ITEM";
cin>>s[i].it_code;
gotoxy(20,10);
cout<<"RATE OF THE ITEM";
cin>>s[i].it_rate;
gotoxy(20,22);
cout<<"do you want to continue?(press y)";
cin>>ans;
++i;
}while(ans=='y');
cout<<"\n new products have been added to the store ,now the customer can place the
order";
n=i;
order();
}
cout<<"\n\n do want the products to be delivered?(press y for yes)";
delay(120);
cout<<"\nFREE DELIVERY IF THE PURCHASE EXCEEDS Rs.1000\tELSE Rs.25FOR DELIVERY";
cin>>u;
if(u=='y')
{cout<<"\n\nEnter distance (kilometer) from here ";
cin>>p;
if(p<=5)
address();
else
cout<<"\n\nlimit is only upto 5 km. SORRY PRODUCTS CANNOT BE DELIVERED";
}
}
}

//this function takes order from the customer


void order()
{
int no,i=0,j,flag=0;
char ans='y';
do
{
flag=0;
clrscr();
gotoxy(20,6);
cout<<"enter memo number";
cin>>c[i].memo;
gotoxy(20,8);
cout<<"ENTER ITEM CODE";
cin>>c[i].i_code;
gotoxy(20,10);
cout<<"ENTER QUANTITY REQUIRED";
cin>>c[i].quantity;
for(j=0;j<n;++j)
{if(strcmp(s[j].it_code,c[i].i_code)==0)
{clrscr();
gotoxy(20,8);
cout<<"Name=>"<<s[j].it_name;
gotoxy(20,10);
cout<<"ITEM CODE=>"<<s[j].it_code;
gotoxy(20,12);
cout<<"RATE=>"<<s[j].it_rate;
++flag;
strcpy(c[i].i_name,s[j].it_name);
c[i].rate=s[j].it_rate;
}
}
if(flag==0)
{
gotoxy(20,16);
cout<<"sorry item not found";
}
gotoxy(20,22);
cout<<"Do you want to continue?\t(press y)";
cin>>ans;
++i;
}while(ans=='y');
m=i;
cout<<"\nit's time for billing";
bill();
}

//this function display the bill


void bill()
{
clrscr();
int no,row,i;
float total,total1;
dat dob;
gotoxy(20,6);
cout<<"ENTER CASH MEMO NUMBER";
cin>>no;
gotoxy(20,8);
cout<<"ENTER DATE";
gotoxy(20,80);
cin>>dob.dd;
gotoxy(35,8);
cin>>dob.mm;
gotoxy(38,8);
cin>>dob.yy;
clrscr();
gotoxy(13,3);
cout<<"CASH MEMO NUMBER"<<no;
gotoxy(10,4);
cout<<"CASH MEMO";
cout<<"DATE:"<<dob.dd<<"/"<<dob.mm<<"/"<<dob.yy;
gotoxy(10,6);
cout<<"ITEM CODE:";
gotoxy(20,6);
cout<<"NAME:";
gotoxy(30,6);
cout<<"QUANTITY:";
gotoxy(40,6);
cout<<"RATE:";
gotoxy(50,7);
cout<<"TOTAL";
gotoxy(10,7);
cout<<"................................";
total=0;
float gtotal=0;
row=8;
for(i=0;i<=m;++i)
{if(no==c[i].memo)
{
gotoxy(10,row);
cout<<c[i].i_code;
gotoxy(20,row);
cout<<c[i].i_name;
gotoxy(30,row);
cout<<c[i].quantity;
gotoxy(40,row);
cout<<c[i].rate;
total=c[i].quantity*c[i].rate;
gotoxy(50,row);
cout<<total;
gtotal=gtotal+total;
row++;
}}

if(u=='y')
{if(gtotal<1000)
cout<<"\ndelivery charges:\t\tRs.25:";
gtotal+=25;}
cout<<"\n GST(tax)\t\t(10%)";
float tax;
tax=gtotal*10/100;
gtotal+=tax;
gotoxy(20,23);
cout<<"GRAND TOTAL"<<gtotal;
getch();}

void address()
{
int house_no;
char street_name[50],land_mark[50];
long double pin_code;
cout<<"\nenter house number";
cin>>house_no;
cout<<"enter street name";
gets(street_name);
cout<<"\nenter land mark";
gets(land_mark);
cout<<"\nenter pin code";
cin>>pin_code;
cout<<"\n your order will be delivered tomorrow";
}