diff --git a/README.md b/README.md index 90dc15c..358ab2e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Buffer_3.0 Buffer 3.0 Repository to submit your projects +we have written a code to perform basic functions such as add, display and serve orders in a fast food restaurant. diff --git a/Team-Loop_lapeta/main.cpp b/Team-Loop_lapeta/main.cpp new file mode 100644 index 0000000..cfe75cf --- /dev/null +++ b/Team-Loop_lapeta/main.cpp @@ -0,0 +1,188 @@ +#include +#include +#include +using namespace std; + +class Burger +{ + int front,rear, f, r,q[5]; + char o[5]; + public: + Burger() + { + front=-1; + rear=-1; + f=-1; + r=-1; + } + + int isfull() + { + if((front==0&&rear==4)||front==rear+1) + { + return 1; + } + else + { + return 0; + } + } + + int isfull2() + { + if((f==0&&r==4)||f==r+1) + { + return 1; + } + else + { + return 0; + } + } + + int isempty() + { + if(front==-1&&rear==-1) + { + return 1; + } + else + { + return 0; + } + } + + int isempty2() + { + if(f==-1&&r==-1) + { + return 1; + } + else + { + return 0; + } + } + + void add() + { + if(isfull()==0 && isfull2()==0) + { + cout<<"\n\n a. Veg Burger b. Chicken Burger c. Paneer Burger d. Special Veg Burger"; + cout<<"\n Enter the Burger ID and items: "; + if(front==-1&&rear==-1&&f==-1&&r==-1) + { + f=0; + r=0; + front=0; + rear=0; + cin>>q[rear]; + cin>>o[r]; + cout<>q[rear]; + cin>>o[r]; + } + + char c; + cout<<" Do you want to add another order ? "; + cin>>c; + if(c=='y'||c=='Y') + add(); + } + else + { + cout<<"\n Orders are full "; + } + + + } + + void serve() + { + if(isempty()==0 && isempty2()==0) + { + if(front==rear) + { + cout<<"\n Order served is : "<>ch; + switch(ch) + { + case 1: + add(); + break; + + case 2: + display(); + break; + + case 3: + serve(); + break; + + case 4: + exit(0); + + default: + cout<<" Invalid choice "; + check(); + } + char ch1; + cout<<"\n Do you want to continue? "; + cin>>ch1; + if(ch1=='y'||ch1=='Y') + check(); + } +}; + + int main() + { + Burger b1; + b1.check(); + return 0; + }