Está en la página 1de 10

void border (void)

////////////////////GLOBEL/////////////////////////
int z=1
class Ingredients
Begin
private:
char
onion[20],tomato[20],garlic[20],ginger[20],pepper[20],chilli[20],oil[20],salt
[20],chicken[20],rice[20]
public:
//////////////////// SETTER///////////////////////////////////
void setchicken (char t[])
Begin
int i=0
while(t[i]!=NULL)
Begin
chicken[i]=t[i]
i++
End-while
chicken[i]=NULL
End
void setrice (char w[])
Begin
int i=0
while(w[i]!=NULL)
Begin
rice[i]=w[i]
i++
End-while
rice[i]=NULL
End
void setonion (char a[])
Begin
int i=0
while(a[i]!=NULL)
Begin
onion[i]=a[i]
i++
End-while
onion[i]=NULL
End
void settomato (char b[])
Begin

int i=0
while(b[i]!=NULL)
Begin
tomato[i]=b[i]
i++
End-while
tomato[i]=NULL
End
void setgarlic (char c[])
Begin

int i=0
while(c[i]!=NULL)
Begin
garlic[i]=c[i]
i++
End-while
garlic[i]=NULL
End
void setginger (char d[])
Begin

int i=0
while(d[i]!=NULL)
Begin
ginger[i]=d[i]
i++
End-while
ginger[i]=NULL
End
void setpepper (char e[])
Begin

int i=0
while(e[i]!=NULL)
Begin
pepper[i]=e[i]
i++
End-while
pepper[i]=NULL
End
void setchilli (char f[])
Begin

int i=0
while(f[i]!=NULL)
Begin
chilli[i]=f[i]
i++
End-while
chilli[i]=NULL
End
void setoil (char p[])
Begin
int i=0
while(p[i]!=NULL)
Begin
oil[i]=p[i]
i++
End-while
oil[i]=NULL
End
void setsalt (char g[])
Begin

int i=0
while(g[i]!=NULL)
Begin
salt[i]=g[i]
i++
End-while
salt[i]=NULL
End
//////////////////////////GETTER/////////////////////////////
char* getchicken()
Begin
return chicken
End
char* getrice()
Begin
return rice
End
char* getonion()
Begin
return onion
End
char* gettomato()
Begin
return tomato
End
char* getgarlic()
Begin
return garlic
End
char* getginger()
Begin
return ginger
End
char* getpepper()
Begin
return pepper
End
char* getchilli()
Begin
return chilli
End
char* getoil()
Begin
return oil
End
char* getsalt ()
Begin
return salt
End

///////////////////////////////TIME CLASS//////////////////////////////////
class Time
Begin
private:
friend istream& operator>>(istream& Read,Time& t)
friend ostream& operator<<(ostream& Display,Time& t)
int hour,min,sec
public:
void sethour (int a=0)
Begin
hour =a
End
void setmin (int b=0)
Begin
min =b
End
void setsec (int c=0)
Begin
sec =c
End

int gethour ()
Begin
return hour
End
int getmin ()
Begin
return min
End
int getsec ()
Begin
return sec
End

//////////////////////////////////DISH CLASS//////////////////////////////
class dish :public Ingredients
Begin
private:
char name[100]
char method[1000]
Time t
int sno
friend istream& operator>>(istream& Read,dish &a)
friend ostream& operator<<(ostream& Display,dish &a)
friend void list(dish s)
public:
void setname (char a[])
Begin
int i=0
while(a[i]!=NULL)
Begin
name[i] =a[i]
i++
End-while
name[i]=NULL
End
void setmethod (char b[])
Begin
int i=0
while(b[i]!=NULL)
Begin
method[i] =b[i]
i++
End-while
method[i]=NULL
End
void settime ()
Begin
Read t
End
void settime(int a,int b,int c)
Begin
t.sethour(a)
t.setmin(b)
t.setsec(c)
End
void getTime()
Begin
Displayt
End
char* getname()
Begin
return name
End
char* getmethod()
Begin
return method
End
void setsno(int a=0)
Begin
sno=a
End
int getsno()
Begin
return sno
End
void delet (dish s)
int record(dish s)
/////////////////////////////OPERATOR OVERLODING////////////////////////////
istream& operator>>(istream &Read,Time &t)
Begin int x
Read x Display t.sethour(x)
Read x Display t.setmin(x)
Read x Display t.setsec(x)
return Read
End
ostream& operator<<(ostream &Display,Time &t)
Begin
Display t.gethour()
Display t.getmin()
Display t.getsec()
return Display
End
istream &operator>>(istream &Read,dish &a)
Begin
char x[50] char y[1000]
Display NAME OF THE RECEPIE::
gets (x) a.setname(x)
Display <<< INGREDIENTS >>>
Display CHICKEN
gets(x) a.setchicken(x)
Display RICE
gets(x) a.setrice(x)
Display ONION
gets(x) a.setonion(x)
Display TOMOTO
gets(x) a.settomato(x)
Display GARLIC
gets(x) a.setgarlic(x)
Display GINGER
gets(x) a.setginger(x)
Display PEPPER
gets(x) a.setpepper(x)
Display CHILLI
gets(x) a.setchilli(x)
Display OIL
gets(x) a.setoil(x)
Display SALT
gets(x) a.setsalt(x)
Display TOTAL TIME OF RECEPIE
a.settime()
Display ENTER THE METHOD OF RECEPIE
gets(y) a.setmethod(y)
return Read
End
ostream &operator<<(ostream &Display,dish &a)
Begin

Display Recepie No. Displaya.getsno()


Display NAME OF THE RECEPIE::
Displaya.getname()
Display INGREDIENTS
Display CHICKEN
Displaya.getchicken()
Display RICE
Displaya.getrice()
Display ONION
Display a.getonion()
Display TOMOTO
Displaya.gettomato()
Display GARLIC
Displaya.getgarlic()
Display GINGER
Displaya.getginger()
Display PEPPER
Displaya.getpepper()
Display CHILLI
Displaya.getchilli()
Display OLI
Displaya.getoil()
Display SALT
Displaya.getsalt()
Display TOTLE TIME OF RECEPIE
a.getTime()
Display THE METHOD OF RECEPIE
Displaya.getmethod()
return Display
End
///////////////////////////////NEW ENTRY///////////////////////////////
void newentry(dish s)
Begin
ofstream out( saira.dat ,ios::app|ios::binary)
int i i=record(s)
char choice='y'
while(choice=='y'||choice=='Y')
Begin
s.setsno(i+1)
Read s
out.write((char*)&s,sizeof(s))
Display Enter New Entry Press ...Y
i++
choice=getche()
End-while
End
///////////////////////////////RECORD//////////////////////////////////
int record(dish s)
Begin int i=0
ifstream in( saira.dat , ios::binary)
while(in.read((char*)&s,sizeof(s)))
Begin
i++
End
return i
End
/////////////////////////////LIST/////////////////////////////////////
void list(dish s)
Begin
int m=0 ,u=record(s)
if(m<u)
Begin
ifstream in( saira.dat ,ios::binary)
while(in.read((char *)&s,sizeof(s)))
Begin
Displays getch()
End-while
End-if
else
Begin
Display NO Record Found.....
End-else
getch()
End
////////////////////////////////FIX//////////////////////////////////
void fix (dish s)
Begin
ofstream out( saira.dat ,ios::binary)
s.setsno(1)
s.setname( Chicken Masala Biryani)
s.setchicken( 1kg )
s.setrice( 1kg )
s.setonion( 12small (cut finly) )
s.settomato( 6large )
s.setginger( 10tbsp )
s.setgarlic( 10tbsp )
s.setpepper( pwd 1/2tsp )
s.setchilli( powder 2tsp )
s.setoil( 1cup )
s.setsalt( to taste )
s.settime(90,0,0)
s.setmethod( 1. Soak rice for 20 mins. \n\n 2. Heat oil fry onion
untill they are golden brown take out and =\n pread on paper after gets
crispy, grind them.\n\n 3. Add ginger garlic paste fry min 20mins or smell
remove =roperly,\n add all condiments add chicken fry a while add fried
=nion,yogurt\n\n 4. LAYERS: Boil rice in a large vessel add a few mint
leaves,whole\n ondiments and 1 lemon's juice.\n\n 5. When rice half-
done throw water .\n\n 6. Divide rice & chicken into three parts, Now in
another large essel\n spread one layer of rice ,on layer spread one part of
chicken,sprink\n ood colour, mint leaves,green chillies,lemon slices do
same twicemore.\n 7. Serve hot with raita and salad. )
out.write ((char*)&s,sizeof(s))
s.setsno(2)
s.setname( Chicken Rustum )
s.setchicken( 1kg )
s.setonion( 12small (cut finly) )
s.settomato( (chopped) 750 gms )
s.setginger( 5 gms )
s.setgarlic( 5 gms )
s.setpepper( pwd 1/2tsp )
s.setchilli( powder 15gms )
s.setoil( 200 ml )
s.setsalt( to taste )
s.settime(40,0,28)
s.setmethod( 1. Wash & clean the chicken.\n\n 2. Add oil in a pan
& deep fry the chicken in it\n\n 3. When the chicken tenderizes take out from
the pan.\n\n 4. Now in the pan,fry ginger & garlic.\n\n 5. Add nutmeg &
mace,salt,red chilli,fenugreek & add tomatoes & fry well.\n\n 6. After 3-4
minutes add chicken in the pan,cook for a while & serve hot. )
out.write ((char*)&s,sizeof(s))
End
////////////////////////////////////MODIFY///////////////////////////////////
void modify (dish s)
Begin
ifstream in( saira.dat ,ios::binary)
ofstream out( temp.dat ,ios::binary|ios::app)
Display FOR MODIFY
Display Enter the serial no......
int m,r
Read m
r=record(s)
if(m<=r)
Begin
while(in.read((char*)&s,sizeof(s)))
Begin
if(m==s.getsno())
Begin
Read s
out.write ((char*)&s,sizeof(s))
Display Please Check Record is modified.......
End-if
else
Begin
out.write ((char*)&s,sizeof(s))
End-else
End-while
remove ( saira.dat )
rename ( temp.dat , saira.dat )

End-if
else
Begin
Display Sorry No Record Found!!!!
End-while
getch()
End
////////////////////////////////////DELET///////////////////////////////
void delet (dish s)
Begin
ifstream in( saira.dat ,ios::binary)
ofstream out( temp.dat ,ios::binary|ios::app)
Display FOR DELET
Display Enter the serial no......
int m,r,x=0
Read m
r=record(s)
if(m<=r)
Begin
while(in.read((char*)&s,sizeof(s)))
Begin
if(x==0)
Begin
if(m!=s.getsno())
Begin
out.write ((char*)&s,sizeof(s))
End-if
else
Begin
x++
End-else
End-while
else
Begin
if(m!=s.getsno())
Begin
s.setsno(s.getsno()-1)
out.write ((char*)&s,sizeof(s))
End-if
End-else
End-while
Display Please check record is delet....
remove( saira.dat )
rename( temp.dat , saira.dat )

End-if
else
Begin
Display Sorry No Record Found!!!!
End-else
getch()
End
void mainborder()
////////////////////////////////MAIN//////////////////////////////////
void main (void)
Begin
dish s
fix(s)
int f=0
char x
while(f==0)
Begin
x=display()
if(x=='1')
Begin
newentry(s)
End-if
if(x=='2')
Begin
list(s)
End-if
if(x=='3')
Begin
modify(s)
End-if
if(x=='4')
Begin
delet(s)
End-if
if(x=='5')
Begin

Display (T H A N K Y O U ......)
f++
End-if
End-while
getch()
End
////////////////////////////////////DISPLAY//////////////////////////////
char display (void)
Begin

char n
Display MAIN MENU
Display 1 - ENTER NEW RECIPE
Display 2 - LIST THE RECIPE
Display 3 - MODIFY RECIPE
Display 4 - DELET RECIPE
Display 5 - EXIT
Display Enter Your Choice::
n=getche()
return n
End

También podría gustarte