Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- #include<windows.h>
- #include<conio.h>
- typedef struct node
- {
- char foodname[30];
- int data, stock;
- float price;
- struct node *next;
- }node;
- node *head, *menu;
- int credit_card[20];
- float total_poisa[20];
- char problem_box[20];
- void print(char list[])
- {
- printf("%s", list);
- }
- void line(int cnt)
- {
- int i;
- for(i=1; i<=cnt; i++)
- printf("\n");
- }
- void tab(int cnt)
- {
- int i;
- for(i=1; i<=cnt; i++)
- printf("\t");
- }
- void scr()
- {
- system("cls");
- }
- foodlist()
- {
- line(10); tab(20); print("1. \"*Food Menu |\"");line(2); Sleep(350);
- line(10); tab(20); print("2. \"*Admin Log In |\"");line(2); Sleep(350);
- line(10); tab(20); print("3. \"*Rules & Reg |\"");line(2); Sleep(350);
- line(10); tab(20); print("4. \"*Problem & Suggestion |\"");line(2); Sleep(350);
- line(10); tab(20); print("5. \"*Exit |\"");line(2); Sleep(350);
- }
- void insertfood(char foodname[30], int data, int stock, float price)
- {
- node *temp;
- temp=(node*)malloc(sizeof(node));
- temp->data=data;
- temp->stock=stock;
- temp->price=price;
- strcpy(temp->foodname,foodname);
- temp->next=NULL;
- if(head==NULL)
- {
- head=temp;
- menu=head;
- }
- else
- {
- while(head->next!=NULL)
- {
- head=head->next;
- }
- head->next=temp;
- }
- }
- void foodlist()
- {
- node *start;
- start=menu;
- printf("---------------------------------------------------\n");
- printf(" Item Number | Food Name | Price | Stock \n");
- while(start!=NULL)
- {
- printf("---------------------------------------------------\n");
- line(30); tab(30);
- printf(" %d | %s | %d | %.2f \n", start->data, start->foodname, start->stock, start->price);Sleep(200);line(3);
- printf("---------------------------------------------------\n");
- start=start->next;
- }
- }
- int count()
- {
- int cnt=0;
- node *temp;
- temp=menu;
- while(temp!=NULL)
- {
- temp=temp->next;
- cnt++;
- }
- return cnt;
- }
- int total_money(int foodchoice, int much)
- {
- scr();
- node *temp;
- temp=(node*)malloc(sizeof(node));
- temp=menu;
- while(temp->data!=foodchoice)
- {
- temp=temp->next;
- }
- if(temp->data==foodchoice)
- {
- int o;
- float total=temp->price*much;
- line(3);tab(2); print("Total money for your order: ");line(2);
- line(3);tab(2); printf("%.2f", total); line(2);
- line(10);tab(20); print("Enter your table number: ");line(2);
- line(10);tab(20); scanf("%d", &o);line(2);
- return total;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement