ads

Showing posts with label c mini project. Show all posts
Showing posts with label c mini project. Show all posts

Sunday, July 22, 2018

Snake game











Source Code:


#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <conio.h>
#include<time.h>
#include<ctype.h>
#include <time.h>
#include <windows.h>
#include <process.h>
#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77
int length;
int bend_no;
int len;
char key;
void record();
void load();
int life;
void Delay(long double);
void Move();
void Food();
int Score();
void Print();
void gotoxy(int x, int y);
void GotoXY(int x,int y);
void Bend();
void Boarder();
void Down();
void Left();
void Up();
void Right();
void ExitGame();
int Scoreonly();
struct coordinate{
    int x;
    int y;
    int direction;
};
typedef struct coordinate coordinate;
coordinate head, bend[500],food,body[30];
int main()
{
    char key;
    Print();
    system("cls");
    load();
    length=5;
    head.x=25;
    head.y=20;
    head.direction=RIGHT;
    Boarder();
    Food(); //to generate food coordinates initially
    life=3; //number of extra lives
    bend[0]=head;
    Move();   //initialing initial bend coordinate
    return 0;
}
void Move()
{
    int a,i;
    do{
        Food();
        fflush(stdin);
        len=0;
        for(i=0;i<30;i++)
        {
            body[i].x=0;
            body[i].y=0;
            if(i==length)
            break;
        }
        Delay(length);
        Boarder();
        if(head.direction==RIGHT)
            Right();
        else if(head.direction==LEFT)
            Left();
        else if(head.direction==DOWN)
            Down();
        else if(head.direction==UP)
            Up();
        ExitGame();
    }while(!kbhit());
    a=getch();
    if(a==27)
    {
        system("cls");
        exit(0);
    }
    key=getch();
    if((key==RIGHT&&head.direction!=LEFT&&head.direction!=RIGHT)||(key==LEFT&&head.direction!=RIGHT&&head.direction!=LEFT)||(key==UP&&head.direction!=DOWN&&head.direction!=UP)||(key==DOWN&&head.direction!=UP&&head.direction!=DOWN))
    {
        bend_no++;
        bend[bend_no]=head;
        head.direction=key;
        if(key==UP)
            head.y--;
        if(key==DOWN)
            head.y++;
        if(key==RIGHT)
            head.x++;
        if(key==LEFT)
            head.x--;
        Move();
    }
    else if(key==27)
    {
        system("cls");
        exit(0);
    }
    else
    {
        printf("\a");
        Move();
    }
}
void gotoxy(int x, int y)
{
 COORD coord;
 coord.X = x;
 coord.Y = y;
 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void GotoXY(int x, int y)
{
    HANDLE a;
    COORD b;
    fflush(stdout);
    b.X = x;
    b.Y = y;
    a = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(a,b);
 }
void load(){
    int row,col,r,c,q;
    gotoxy(36,14);
    printf("loading...");
    gotoxy(30,15);
    for(r=1;r<=20;r++){
    for(q=0;q<=100000000;q++);//to display the character slowly
    printf("%c",177);}
    getch();
}
void Down()
{
    int i;
    for(i=0;i<=(head.y-bend[bend_no].y)&&len<length;i++)
    {
        GotoXY(head.x,head.y-i);
        {
            if(len==0)
                printf("v");
            else
                printf("*");
        }
        body[len].x=head.x;
        body[len].y=head.y-i;
        len++;
    }
    Bend();
    if(!kbhit())
        head.y++;
}
void Delay(long double k)
{
    Score();
    long double i;
    for(i=0;i<=(10000000);i++);
}
void ExitGame()
{
    int i,check=0;
    for(i=4;i<length;i++)   //starts with 4 because it needs minimum 4 element to touch its own body
    {
        if(body[0].x==body[i].x&&body[0].y==body[i].y)
        {
            check++;    //check's value increases as the coordinates of head is equal to any other body coordinate
        }
        if(i==length||check!=0)
            break;
    }
    if(head.x<=10||head.x>=70||head.y<=10||head.y>=30||check!=0)
    {
        life--;
        if(life>=0)
        {
            head.x=25;
            head.y=20;
            bend_no=0;
            head.direction=RIGHT;
            Move();
        }
        else
        {
            system("cls");
            printf("All lives completed\nBetter Luck Next Time!!!\nPress any key to quit the game\n");
            record();
            exit(0);
        }
    }
}
void Food()
{
    if(head.x==food.x&&head.y==food.y)
    {
        length++;
        time_t a;
        a=time(0);
        srand(a);
        food.x=rand()%70;
        if(food.x<=10)
            food.x+=11;
        food.y=rand()%30;
        if(food.y<=10)
            food.y+=11;
    }
    else if(food.x==0)/*to create food for the first time coz global variable are initialized with 0*/
    {
        food.x=rand()%70;
        if(food.x<=10)
            food.x+=11;
        food.y=rand()%30;
        if(food.y<=10)
            food.y+=11;
    }
}
void Left()
{
    int i;
    for(i=0;i<=(bend[bend_no].x-head.x)&&len<length;i++)
    {
        GotoXY((head.x+i),head.y);
       {
                if(len==0)
                    printf("<");
                else
                    printf("*");
        }
        body[len].x=head.x+i;
        body[len].y=head.y;
        len++;
    }
    Bend();
    if(!kbhit())
        head.x--;
}
void Right()
{
    int i;
    for(i=0;i<=(head.x-bend[bend_no].x)&&len<length;i++)
    {
        //GotoXY((head.x-i),head.y);
        body[len].x=head.x-i;
        body[len].y=head.y;
        GotoXY(body[len].x,body[len].y);
        {
            if(len==0)
                printf(">");
            else
                printf("*");
        }
        /*body[len].x=head.x-i;
        body[len].y=head.y;*/
        len++;
    }
    Bend();
    if(!kbhit())
        head.x++;
}
void Bend()
{
    int i,j,diff;
    for(i=bend_no;i>=0&&len<length;i--)
    {
            if(bend[i].x==bend[i-1].x)
            {
                diff=bend[i].y-bend[i-1].y;
                if(diff<0)
                    for(j=1;j<=(-diff);j++)
                    {
                        body[len].x=bend[i].x;
                        body[len].y=bend[i].y+j;
                        GotoXY(body[len].x,body[len].y);
                        printf("*");
                        len++;
                        if(len==length)
                            break;
                    }
                else if(diff>0)
                    for(j=1;j<=diff;j++)
                    {
                        /*GotoXY(bend[i].x,(bend[i].y-j));
                        printf("*");*/
                        body[len].x=bend[i].x;
                        body[len].y=bend[i].y-j;
                        GotoXY(body[len].x,body[len].y);
                        printf("*");
                        len++;
                        if(len==length)
                            break;
                    }
            }
        else if(bend[i].y==bend[i-1].y)
        {
            diff=bend[i].x-bend[i-1].x;
            if(diff<0)
                for(j=1;j<=(-diff)&&len<length;j++)
                {
                    /*GotoXY((bend[i].x+j),bend[i].y);
                    printf("*");*/
                    body[len].x=bend[i].x+j;
                    body[len].y=bend[i].y;
                    GotoXY(body[len].x,body[len].y);
                        printf("*");
                   len++;
                   if(len==length)
                           break;
               }
           else if(diff>0)
               for(j=1;j<=diff&&len<length;j++)
               {
                   /*GotoXY((bend[i].x-j),bend[i].y);
                   printf("*");*/
                   body[len].x=bend[i].x-j;
                   body[len].y=bend[i].y;
                   GotoXY(body[len].x,body[len].y);
                       printf("*");
                   len++;
                   if(len==length)
                       break;
               }
       }
   }
}
void Boarder()
{
   system("cls");
   int i;
   GotoXY(food.x,food.y);   /*displaying food*/
       printf("F");
   for(i=10;i<71;i++)
   {
       GotoXY(i,10);
           printf("!");
       GotoXY(i,30);
           printf("!");
   }
   for(i=10;i<31;i++)
   {
       GotoXY(10,i);
           printf("!");
       GotoXY(70,i);
       printf("!");
   }
}
void Print()
{
   //GotoXY(10,12);
   printf("\tWelcome to the mini Snake game.(press any key to continue)\n");
  getch();
   system("cls");
   printf("\tGame instructions:\n");
   printf("\n-> Use arrow keys to move the snake.\n\n-> You will be provided foods at the several coordinates of the screen which you have to eat. Everytime you eat a food the length of the snake will be increased by 1 element and thus the score.\n\n-> Here you are provided with three lives. Your life will decrease as you hit the wall or snake's body.\n\n-> YOu can pause the game in its middle by pressing any key. To continue the paused game press any other key once again\n\n-> If you want to exit press esc. \n");
   printf("\n\nPress any key to play game...");
   if(getch()==27)
   exit(0);
}
void record(){
   char plname[20],nplname[20],cha,c;
   int i,j,px;
   FILE *info;
   info=fopen("record.txt","a+");
   getch();
   system("cls");
   printf("Enter your name\n");
   scanf("%[^\n]",plname);
   //************************
   for(j=0;plname[j]!='\0';j++){ //to convert the first letter after space to capital
   nplname[0]=toupper(plname[0]);
   if(plname[j-1]==' '){
   nplname[j]=toupper(plname[j]);
   nplname[j-1]=plname[j-1];}
   else nplname[j]=plname[j];
   }
   nplname[j]='\0';
   //*****************************
   //sdfprintf(info,"\t\t\tPlayers List\n");
   fprintf(info,"Player Name :%s\n",nplname);
    //for date and time
   time_t mytime;
  mytime = time(NULL);
  fprintf(info,"Played Date:%s",ctime(&mytime));
     //**************************
     fprintf(info,"Score:%d\n",px=Scoreonly());//call score to display score
     //fprintf(info,"\nLevel:%d\n",10);//call level to display level
   for(i=0;i<=50;i++)
   fprintf(info,"%c",'_');
   fprintf(info,"\n");
   fclose(info);
   printf("wanna see past records press 'y'\n");
   cha=getch();
   system("cls");
   if(cha=='y'){
   info=fopen("record.txt","r");
   do{
       putchar(c=getc(info));
       }while(c!=EOF);}
     fclose(info);
}
int Score()
{
   int score;
   GotoXY(20,8);
   score=length-5;
   printf("SCORE : %d",(length-5));
   score=length-5;
   GotoXY(50,8);
   printf("Life : %d",life);
   return score;
}
int Scoreonly()
{
int score=Score();
system("cls");
return score;
}
void Up()
{
   int i;
   for(i=0;i<=(bend[bend_no].y-head.y)&&len<length;i++)
   {
       GotoXY(head.x,head.y+i);
       {
           if(len==0)
               printf("^");
           else
               printf("*");
       }
       body[len].x=head.x;
       body[len].y=head.y+i;
       len++;
   }
   Bend();
   if(!kbhit())
       head.y--;
}

RESTAURANT MANAGEMENT SYSTEM












SOURCE CODE







#include<stdio.h>
#include<conio.h>
#include<string.h>

#include<stdlib.h>

//Global variables............
int advance[5]={750,500,400,500,750};
int  r_no[5]={1,2,3,4,5};
int room;
int tot[5]={0,0,0,0,0};
int g_tot=0;
int  r_charge[5];
char r_type[5][7];
char r_cust[5][20]={"N.A","N.A","N.A","N.A","N.A"};
char c_city[5][20];
char name[30];
int  c_mem[5];
char c_nat[5][20];
char r_avail[5];
int  r_per[5];
int  no[5];
int year[5];
int month[5];
int day[5];
int i;

//Function .........
void getavail();
void putavail();
void features();
void allocate();
void putcust();
void restaurant();

void cancel();
void intro();
void screenheader();


//Function definitions..........
void screenheader()
 {
   printf("\n                       :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::");
   printf("\n                       ::                                                                                              ::");
   printf("\n                       ::     @@@@@@@@@@@@@@@@@@@@@@@     ::");
   printf("\n                       ::     @                                                                             @     ::");
   printf("\n                       ::     @      WELCOME TO                                             @     ::");
   printf("\n                       ::     @                                                                              @     ::");
   printf("\n                       ::     @    MY RESTURENT                                           @     ::");
   printf("\n                       ::     @                                                                              @     ::");
   printf("\n                       ::     @@@@@@@@@@@@@@@@@@@@@@@     ::");
   printf("\n                       ::                                                                                               ::");
   printf("\n                       :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\n\n");
 }
void intro()
 {
   printf("\n\t             ");
   printf("\n\n              ");
   printf("\n\n\n                             WELCOMES YOU..............");

   printf("\n\t\t\t1. Book your room.\n");
   printf("\t\t\t2.  Wifi services.\n");
   printf("\t\t\t3. Laundary service.\n");
   printf("\nPress any character to continue:");
   getch();
 }
void getavail()
 {
   for(i=0;i<5;i++)
     {
       if(r_no[i]==1)
  {
    strcpy(r_type[i],"Sp Dlx");
    r_charge[i]=1500;
    if(strcmp(r_cust[i],"N.A")==0)
      {
        r_avail[i]='Y';
        r_per[i]=0;
      }
  }
       else if(r_no[i]==2)
  {
    strcpy(r_type[i],"Dlx");
    r_charge[i]=1000;
    if(strcmp(r_cust[i],"N.A")==0)
      {
        r_avail[i]='Y';
        r_per[i]=0;
      }
  }
       else if(r_no[i]==3)
  {
    strcpy(r_type[i],"Gen");
    r_charge[i]=750;
    if(strcmp(r_cust[i],"N.A")==0)
      {
        r_avail[i]='Y';
        r_per[i]=0;
      }
  }
       else if(r_no[i]==4)
  {
    strcpy(r_type[i],"Coupl");
    r_charge[i]=1000;
    if(strcmp(r_cust[i],"N.A")==0)
      {
        r_avail[i]='Y';
        r_per[i]=0;
      }
  }
       else if(r_no[i]==5)
  {
    strcpy(r_type[i],"C Dlx");
    r_charge[i]=1500;
    if(strcmp(r_cust[i],"N.A")==0)
      {
        r_avail[i]='Y';
        r_per[i]=0;
      }
  }
     }
 }
void putavail()
 {

   screenheader();
   printf("\n                          ROOM AVAILABILITY");
   printf("\n                         -------------------");
   printf("\nRoom No| Type | Charge | Availability | Cust_Name | Period |");
   for(i=0;i<5;i++)
     {
       printf("\n%d\t",r_no[i]);

       if(i==0)
  printf("    %d\t%c\t     ",r_charge[i],r_avail[i]);
       if((i==1) || (i==2))
  printf("       %d\t   %c\t        ",r_charge[i],r_avail[i]);
       if(i==3 || i==4)
  printf("     %d\t %c\t      ",r_charge[i],r_avail[i]);

       if((i==1) || (i==2))
  printf("\t %d",r_per[i]);
       else if((i==3) || (i==4))
  printf("\t       %d",r_per[i]);
       else
  printf("\t      %d",r_per[i]);
     }
 }
void features()
 {
   int typ;

   screenheader();
   printf("\nChoose the room type:\n1. Sp. Delux\n2. Delux");
   printf("\n3. General\n4. Couple\n5. C. Delux\n");
   scanf("%d",&typ);
   if(typ>5)
     {
       printf("\nWrong choice!! Choose a number between 1-5:");
       features();
     }
   switch(typ)
     {
       case 1:
       screenheader();
       printf("\n Room number            >>>1");
       printf("\n Advance                >>>750\n\n");
       printf("\n                      FEATURES OF THIS ROOM                       ");
       printf("\n------------------------------------------------------------------");
       printf("\n\n Room Type            >>> Sp.delux");
       printf("\n\n Room charges         >>> Rs.1500 per day");
       printf("\n\n 1. Bed               >>>      2");
       printf("\n\n 2.Capacity           >>>      5");
       printf("\n\n 3.Balcony available     ");
       printf("\n------------------------------------------------------------------");
       printf("\n                     ADDITIONAL FEATURES                        ");
       printf("\n------------------------------------------------------------------");
       printf("\n\n 1.A/C  available ");
       printf("\n\n 2.Geyser available");
       printf("\n\n 3.TV available      ");
       printf("\n------------------------------------------------------------------");
       printf("\n NOTE :- Extra bed will cost Rs.50 per bed ");
       break;
       case 2:
       screenheader();
       printf("\n Room number            >>>2\n\n");
       printf("\n Advance                >>>500\n\n");
       printf("\n                      FEATURES OF THIS ROOM                       ");
       printf("\n-------------------------------------------------------------------");
       printf("\n\n Room Type            >>> Delux                                      ");
       printf("\n\n Room charges         >>>Rs.1000 per day");
       printf("\n\n 1. Bed               >>>      2");
       printf("\n\n 2.Capacity           >>>      5");
       printf("\n-------------------------------------------------------------------");
       printf("\n                    ADDITIONAL FEATURES                        ");
       printf("\n-------------------------------------------------------------------");
       printf("\n\n 1.A/C available   ");
       printf("\n\n 2.Geyser available");
       printf("\n\n 3.TV available      ");
       printf("\n-------------------------------------------------------------------");
       printf("\n NOTE :- Extra bed will cost Rs.50 per bed ");
       break;
       case 3:
       screenheader();
       printf("\n Room number            >>>3\n\n");
       printf("\n Advance                >>>400\n\n");
       printf("\n                      FEATURES OF THIS ROOM                       ");
       printf("\n-------------------------------------------------------------------");
       printf("\n\n Room Type            >>> General                                    ");
       printf("\n\n Room charges         >>>Rs.750 per day");
       printf("\n\n 1. Bed               >>>      2");
       printf("\n\n 2.Capacity           >>>      5");
       printf("\n-------------------------------------------------------------------");
       printf("\n                    ADDITIONAL FEATURES                        ");
       printf("\n-------------------------------------------------------------------");
       printf("\n\n 1.Geyser available      ");
       printf("\n-------------------------------------------------------------------");
       printf("\n NOTE :- Extra bed will cost Rs.50 per bed ");
       break;
       case 4:
       screenheader();
       printf("\n Room number            >>>4\n\n");
       printf("\n Advance                >>>500\n\n");
       printf("\n                      FEATURES OF THIS ROOM                       ");
       printf("\n-------------------------------------------------------------------");
       printf("\n\n Room Type            >>> Couple                                     ");
       printf("\n\n Room charges         >>>Rs.1000 per day");
       printf("\n\n 1. Bed               >>>      1");
       printf("\n\n 2.Capacity           >>>      2");
       printf("\n-------------------------------------------------------------------");
       printf("\n                    ADDITIONAL FEATURES                        ");
       printf("\n-------------------------------------------------------------------");
       printf("\n\n 1.Geyser available");
       printf("\n\n 2.TV available      ");
       printf("\n-------------------------------------------------------------------");
       printf("\n NOTE :- Extra bed will cost Rs.50 per bed ");
       break;
       case 5:
       screenheader();
       printf("\n Room number            >>>5\n\n");
       printf("\n Advance                >>>750\n\n");
       printf("\n                      FEATURES OF THIS ROOM                       ");
       printf("\n-------------------------------------------------------------------");
       printf("\n\n Room Type            >>> Couple Delux                                    ");
       printf("\n\n Room charges         >>>Rs.1500 per day");
       printf("\n\n 1. Bed               >>>      1");
       printf("\n\n 2.Capacity           >>>      2");
       printf("\n-------------------------------------------------------------------");
       printf("\n                    ADDITIONAL FEATURES                        ");
       printf("\n-------------------------------------------------------------------");
       printf("\n\n 1.A/C available   ");
       printf("\n\n 2.Geyser available");
       printf("\n\n 3.TV available      ");
       printf("\n-------------------------------------------------------------------");
       printf("\n NOTE :- Extra bed will cost Rs.50 per bed ");
       break;
     }
 }
void allocate()
 {

   screenheader();
   getavail();
   printf("\n Enter the room number in which you want to stay:");
   scanf("%d",&room);
   if(r_avail[room-1]=='Y')
     {
       fflush(stdin);
       printf("\n Enter Name  :");
       gets(r_cust[room-1]);
       printf("\n Enter city name :");
       gets(c_city[room-1]);
       printf("\n Enter nationality :");
       gets(c_nat[room-1]);
       printf("\n For how many days you want the room :");
       scanf("%d",&r_per[room-1]);
       printf("\n Enter no. of member in your group :");
       scanf("%d",&c_mem[room-1]);
       if((room==1)||(room==2)||(room==3))
  if((c_mem[room-1]<1)||(c_mem[room-1]>5))
    {
      printf("\n %d members cannot be allocated this room.Allowed members are between 1-5.",c_mem[room-1]);
      getch();
      allocate();
    }
       else if((room==4)||(room==5))
  if((c_mem[room-1]<1)||(c_mem[room-1]>2))
    {
      printf("\n %d members cannot be allocated this room.Allowed members are between 1-2.",c_mem[room-1]);
      getch();
      allocate();
    }
       printf("\n Enter the date of arrival :");
       printf("\n------------------------------");
       printf("\n Year : ");
       scanf("%d",&year[room-1]);
       printf("\n Month :");
       scanf("%d",&month[room-1]);
       printf("\n Day :");
       scanf("%d",&day[room-1]);
       if((year[room-1]>9999)||(month[room-1]>12)||(month[room-1]<1)||(day[room-1]<1)||(((month[room-1]==1)||(month[room-1]==3)||(month[room-1]==5)||(month[room-1]==7)||(month[room-1]==8)||(month[room-1]==10)||(month[room-1]==12))&&(day[room-1]>31))||(((month[room-1]==4)||(month[room-1]==6)||(month[room-1]==9)||(month[room-1]==11))&&(day[room-1]>30))||((month[room-1]==2)&&((year[room-1]%400==0)||((year[room-1]%4==0)&&(year[room-1]%100!=0)))&&(day[room-1]>29))||((month[room-1]==2)&&(year[room-1]%4!=0)&&(day[room-1]>28)))
  {

    printf("\n\n!!!!!INVALID DATE........");
    getch();
    allocate();
  }
       else
  {
    printf("\n... Room is allocated to ");

    printf(" for %d days.",r_per[room-1]);
    r_avail[room-1]='N';
    getch();
  }
     }
   else
     {
       printf("\n ERROR : Room cannot be allocated ...");
       printf("\n Room is not available...");
       getch();
     }
 }

void cancel()
 {

   screenheader();
   printf("\nEnter the room number:");
   scanf("%d",&room);
   if(r_cust[room-1]=="N.A")
     {
       printf("\nThe room is empty........");
       getch();
     }
   else
     {
       printf("\nEnter the name of the person staying in the room:");
       fflush(stdin);
       gets(name);
       if(strcmpi(name,r_cust[room-1])==0)
  {
    printf("\nReservation for room number %d is cancelled......",room);
    strcpy(r_cust[room-1],"N.A");
    getch();
  }
       else
  {
    printf("\nInvalid name........");
    getch();
    cancel();
  }
     }
   g_tot=advance[room-1];
   printf("\n\nYour total bill is %d",g_tot);
 }
void putcust()
 {
   int j;

   screenheader();
   printf("\nEnter the room number :");
   scanf("%d",&room);
   j=strcmp(r_cust[room-1],"N.A");
   if(j==0)
     {
       printf("\n Data not available ");
       getch();
     }
   else
     {
       printf("\n Room No        :%d",r_no[room-1]);
       printf("\n Customer Name  :",r_cust[room-1]);

       printf("\n Period         :%d",r_per[room-1]);
       printf("\n City           :",c_city[room-1]);

       printf("\n Nationality    :",c_nat[room-1]);

       printf("\n No of member   :%d",c_mem[room-1]);
       printf("\n Arrival Date   :%d/%d/%d",day[room-1],month[room-1],year[room-1]);
       getch();
     }
 }
void restaurant()
 {
   int count=0,z=0,fc[113],answ;
   char ans;
   int price[113]={245,245,245,245,240,240,240,240,235,235,250,235,235,220,
   215,230,215,240,250,250,250,250,250,250,250,255,245,245,245,245,250,240,
   240,360,290,360,290,370,295,360,290,360,290,250,360,290,360,290,250,370,
   290,360,290,250,250,280,245,290,235,265,240,290,300,256,240,265,270,255,
   255,240,240,235,220,25,30,25,30,35,35,25,30,35,25,35,25,25,30,100,105,105,
   100,105,100,105,125,105,105,100,105,110,115,100,100,100,105,105,105,105,
   125,105,120,120,100};
   char food[113][30]={"CHANA MASALA","MATAR MUSHROOM","RAJMA MAKHANI","DAL MAKHANI",
   "MIXED RAITA","BUNDI RAITA","PINEAPPLE RAITA","SALAD(GREEN)","DUM ALOO",
   "MUSHROOM PANEER","MUTTON MASALA","MUTTON MUGHLAI","MUTTON KORMA",
   "MUTTON DO PYAZA","MUTTON SAGH","MUTTON DAHI","MUTTON ROGAN JOSH",
   "MUTTON CURRY","KADAI MUTTON","KEEMA LEVER","KEEMA MATAR","KEEMA EGG",
   "BRAIN CURRY","EGG CURRY","BUTTER CHICKEN","BUTTER CHICKEN(1/2)",
   "KADAI CHICKEN","KADAI CHICKEN(1/2)","BUTTER CHICKEN(BL)",
   "BUTTER CHICKEN(BL)(1/2)","CHICKEN MUGHLAI","CHICKEN MUGHLAI(1/2)",
   "CHICKEN MASALA","CHICKEN MASALA(1/2)","CHICKEN MASALA(1/4)",
   "CHICKEN SAGH","CHICKEN SAGH(1/2)","CHICKEN DAHI","CHICKEN DAHI(1/2)",
   "CHICKEN DAHI(1/4)","CHICKEN KORMA","CHICKEN KORMA(1/2)",
   "CHICKEN DO PYAZA","CHICKEN DO PYAZA(1/2)","FISH CURRY","CHICKEN CURRY",
   "CHICKEN CURRY(1/2)","CHICKEN CURRY(1/4)","CHILLI CHICKEN","TANDOORI ALOO",
   "CHICKEN TIKKA","SEEKH KABAB","FISH TIKKA","CHICKEN TANDOORI",
   "CHICKEN TANDOORI(1/2)","PANEER TIKKA","CHICKEN SEEKH KABAB",
   "CHICKEN HARA KABAB","CHICKEN BIRYANI","MUTTON BIRYANI","PANEER PULAO",
   "VEG.PULAO","JEERA RICE","STEAMED RICE","RUMALI ROTI","ROTI","NAN",
   "ALOO NAN","PANEER NAN","KEEMA NAN","PARANTHA","ALOO PARANTHA",
   "PANEER PARANTHA","PUDINA PARANTHA","BUTTER NAN","LACHCHA PARANTHA",
   "MISSI ROTI","KHASTA ROTI","VEG.BURGER","PANEER BURGER","CHEESE SANDWICH",
   "VEG.PATTI","CHICKEN PATTI","TEA","COFFEE","COLD COFFEE","PINEAPPLE",
   "STRAWBERRY","CHOCOLATE","BLACK FOREST","DOUBLE STORIED","TRIPLE STORIED",
   "SOFT CONE","VANILLA","STRAWBERRY","CHOCOLATE","CHOCO CHIPS","MANGO",
   "TUTTI FRUITY","LICHI","PISTA BADAM","CHOCOLATE PISTA BADAM","CHOCO DIP",
   "CHOCOLATE LICHI"};

   screenheader();
   printf("\n                        *********");
   printf("\n                        MENU CARD");
   printf("\n                        *********");
   printf("\n\n                        VEGETARIAN");

   for(i=0;i<113;count++,i++)
     {

       printf("%d",i+1);


       printf("%d",price[i]);
       if(count==17)
  {
    count=0;
    printf("\n                              PRESS ANY KEY TO CONTINUE");
    getch();

    screenheader();
  }
       if(i==18)
  {
    printf("\n\n       MUTTON\n");
    count +=3;
  }
       if(i==32)
  {
    printf("\n\n       CHICKEN\n");
    count +=3;
  }
       if(i==57)
  {
    printf("\n\n       BAR-BE-QUE\n");
    count +=3;
  }
       if(i==72)
  {
    printf("\n\n       ROTI-NAN-PARANTHA\n");
    count +=3;
  }
       if(i==91)
  {
    printf("\n\n       BEVERAGES\n");
    count +=3;
  }
       if(i==100)
  {
    printf("\n\n       ICE-CREAMS\n");
    count +=3;
  }
     }
   getch();

   screenheader();
   printf("\n\nPRESS 0 TO GO BACK TO MENU CARD\nPRESS 1 TO CONTINUE ");
   scanf("%d",&answ);
   switch(answ)
     {
       case 0:restaurant();
       break;

       case 1 :
        do
   {
     printf("ENTER THE FOOD CODE YOU WANT TO HAVE :: ");
     scanf("%d",&fc[z]);
     z++;
     puts("DO YOU WANT MORE(Y/N) ::");
     fflush(stdin);
     scanf("%c",&ans);
   }while ((ans=='y')||(ans=='Y'));
        printf("\nEnter your room number:");
        scanf("%d",&room);
        printf("\nEnter your name:");
        fflush(stdin);
        gets(name);
        if(strcmpi(name,r_cust[room-1])!=0)
   {
     printf("\nWrong name...:");
     getch();
     restaurant();
   }
        getch();

        screenheader();
        for(i=0;i<z;i++)
   {

     printf("\t\t\t%d\n",price[fc[i]-1]);
     tot[room-1] +=price[fc[i]-1];
   }
        printf("TOTAL\t\t\t\t%d",tot[room-1]);
        break;

       default:printf("\nWrong choice entered!!!");
        getch();
        restaurant();
     }
 }
void main()
 {
   char ans;
   int ch;
   system("color 4A");
   screenheader();
   intro();
   do
     {

       screenheader();
       printf("\n\n\n                      Choose a category:\n");
       printf("                         1. Get availability\n");
       printf("                         2. Features of room\n");
       printf("                         3. ROOM BOOKING\n");
       printf("                         4. Show customer details\n");
       printf("                         5. Restaurant\n");
       printf("                         6. Cancellation\n");

       printf("                         8. Exit\n");
       scanf("%d",&ch);
       switch(ch)
   {
     case 1:getavail();
     putavail();
     break;
     case 2:features();
     break;
     case 3:allocate();
     break;
     case 4:putcust();
     break;
     case 5:restaurant();
     break;
     case 6:cancel();
     break;


     case 8:exit(0);
     default:printf("\n\n\nWrong choice!!!!\n\nPlease choose 1-6");
      getch();
   }
 printf("\n\nDo you want to continue:y/n");
 fflush(stdin);
 scanf("%c",&ans);
     }while(ans=='y'||ans=='Y');
 }