Ds Mini Project
Ds Mini Project
FEATURES:
● Ice Cream menu and ordering
● Order tracking system (Can view pending and completed orders)
● Admin login and privilege to complete the order
● Admin can edit the menu (add or delete the ice creams)
● Admin can view the inventory and daily sales
TEAM MEMBERS
HARSH VARTAK (60004180028)
HRISHIKESH AVANOOR (60004180033)
HIMANSHU SANKLECHA(60004180032)
CODE:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
#include<string.h>
#include<malloc.h>
#include<ctype.h>
#include<process.h>
#include<windows.h>
struct complete{
int orderNo;
struct queue *next;
};
//basic functions
void addItem(char n[],int p);
void enqueue(int orderNo);
int dequeue(); //returns order no.
void addCompleted(int orderNo);
int itemsSize();
int queueSize();
void create();
void menu();
void takeOrder();
void showStatus();
//admin functions
void addItem_admin();
void deleteItem();
void adminStatus();
void adminLogin();
void changeStatus();
void gotoxy(int x,int y);
void welcome();
int peekQueue();
int itemsSize(){
int c=0;
struct item *ptr;
ptr=start;
while(ptr!=NULL){
c++;
ptr=ptr->next;
}
return c;
}
int queueSize(){
int c=0;
struct queue *ptr;
ptr=head;
while(ptr!=NULL){
c++;
ptr=ptr->next;
}
return c;
}
if(start==NULL){
start=new_item;
}else{
ptr=start;
while(ptr->next!=NULL){
ptr=ptr->next;
}
ptr->next=new_item;
}
}
void welcome(){
int i,k=6,r,q;
gotoxy(40,5);
for(i=0;i<=50;i++)
printf("*");
for(i=0;i<20;i++)
{
gotoxy(40,k);
printf("*");
gotoxy(90,k);
printf("*");
printf("\n");
k++;
}
gotoxy(41,25);
for(i=0;i<=49;i++)
printf("*");
gotoxy(45,7);
printf("**** WELCOME TO 3H's ICE CREAM PARLOUR****");
gotoxy(50,8);
printf("what we offer?");
gotoxy(45,9);
printf("->fast service");
gotoxy(45,10);
printf("->hygiene");
gotoxy(45,11);
printf("->Natural");
gotoxy(45,12);
printf("->order tracking system");
gotoxy(50,14);
printf("menu is being loaded....");
gotoxy(50,15);
for(r=0;r<=20;r++)
{
for(q=0;q<=10000000;q++);
printf("%c",177);
}
gotoxy(50,16);
printf("press any key to start");
getch();
}
int dequeue(){
struct queue *ptr;
if(head==NULL){ //queue empty
return -1;
}else if(head==tail){ //single element
ptr=head;
head=NULL;
tail=NULL;
}else{
ptr=head;
head=head->next;
}
return ptr->orderNo;
}
void addItem_admin(){
char n[10];
int p;
printf("enter name of the ice cream\n");
scanf("%s",&n);
printf("enter amount\n");
scanf("%d",&p);
addItem(n,p);
printf("%s was added in the menu",n);
getch();
}
void deleteItem(){
int k=1,choice,p;
struct item *ptr,*pre;
ptr=start;
printf("********************************\n");
printf("sr no.\t flavours\t price\n");
printf("********************************\n");
while(ptr!=NULL){
void create(){
int i=0;
char name[100];
char arr_n[11][100]={"mango ","sitaphal ","litchi ","coconut ","jackfruit ","kesar pista","chickoo
","chocobite ","kaju kismis","anjeer "};
int arr_p[]={60,50,50,70,50,60,70,50,70,70};
for(i=0;i<10;i++){
strcpy(name,arr_n+i);
addItem(name,arr_p[i]);
}
}
void menu(){
int k=1;
struct item *ptr;
ptr=start;
printf("********************************\n");
printf("sr no.\t flavours\t price\n");
printf("********************************\n");
while(ptr!=NULL){
printf("%d\t %s\t %d rs\n\n",k,ptr->name,ptr->price);
ptr=ptr->next;
k++;
}
takeOrder();
getch();
}
void takeOrder(){
struct item *iceCream;
iceCream=start;
int choice,orderNO;
char again;
printf("enter ice cream no.\n\n");
scanf("%d",&choice);
}
printf("you selected %s\n\n",iceCream->name);
iceCream->orders+=1;
orderNO=orders++;
printf("your order no is %d\n",orderNO);
enqueue(orderNO);
printf("\npress any key to return\n\n");
}else{
printf("please select between 1 to %d\n\n",itemsSize());
takeOrder();
}
}
void showStatus(){
char c;
struct queue *ptr;
ptr=head;
printf("pending\n");
while(ptr!=NULL){
printf("%d\n",ptr->orderNo);
ptr=ptr->next;
}
ptr=c_start;
printf("\ncompleted\n");
while(ptr!=NULL){
printf("%d\n",ptr->orderNo);
ptr=ptr->next;
}
printf("\n\npress any key\n\n");
getch();
}
void adminStatus(){
struct item *iceCream;
int price,orders,total,sale=0;
char name[11];
iceCream=start;
printf("product price orders total\n");
while(iceCream!=NULL){
strcpy(name,iceCream->name);
price =iceCream->price;
orders=iceCream->orders;
total = price*orders;
printf("%s \t%d\t%d\t%d\n",name,price,orders,total);
sale+=total;
iceCream=iceCream->next;
}
printf("total sale = %d\n",sale);
printf("\npress any key to return\n");
getch();
}
void adminLogin(){
char pass[10];
char password[]="qwerty";
int result=-1,c;
int p=0;
printf("enter password for admin\n");
do{
pass[p]=getch();
if(pass[p]!='\r'){
printf("*");
}
p++;
}while(pass[p-1]!='\r');
pass[p-1]='\0';
result=strcmp(pass,password);
if(result!=0){
printf("incorrect password\n");
}else{
do{
system("cls");
printf("\n\n1.inventory\t2.add item\t3.delete item\t4.change status \t5.logout\n");
scanf("%d",&c);
switch(c){
case 1:adminStatus();
break;
case 2:addItem_admin();
break;
case 3:deleteItem();
break;
case 4:changeStatus();
break;
case 5:break;
default:;
}
}while(c!=5);
}
}
void changeStatus(){
int c=-1,c1=0,orderNo;
system("cls");
showStatus();
SetConsoleCursorPosition(a,coord);
}
int peekQueue(){
return head->orderNo;
int main()
{
int c;
welcome();
create();
do{
system("cls");
printf("********main menu*********\n\n");
printf("items in menu %d \t pending orders %d\n\n",itemsSize(),queueSize());
printf(" 1. MENU AND ORDER\n\n 2. ORDER STATUS\n\n 3. ADMIN LOGIN\n\n 4.
EXIT\n\n");
printf(" enter choice\n");
scanf("%d",&c);
switch(c)
{
case 1: menu();
break;
case 2: showStatus();
break;
case 3: adminLogin();
break;
case 4:break;
}
}
while(c!=4);
OUTPUT: