Documentos de Académico
Documentos de Profesional
Documentos de Cultura
////////////////////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
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