⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fooddeta.bak

📁 Hotel Management System in c++
💻 BAK
字号:
#include<stdio.h>
#include<conio.h>

typedef struct FOOD
{
 char cid[10];
 int no;
 float bfast,lunch,dinner,misc;
 };

void foodcharge()
{
 FILE *foodptr,*cin;
 FOOD fd;
 CUST c;
 float amt;
 char cid[10];
 int recf=0,res=0,re=0;
 cin=fopen("c:\\hotel\\database\\checkin.dat","rb");
 foodptr=fopen("c:\\hotel\\database\\food.dat","ab+");
 clrscr();
 panel();
 statusbar("Please Enter Customer ID");
 textcolor(YELLOW);
 gotoxy(10,6);
 cprintf("Enter The Customer ID :-> ");
 scanf("%s",cid);
 while(fread(&c,sizeof(c),1,cin)==1)
 {
  if(strcmpi(cid,c.cid)==0)
  {
   recf=1;
   break;
  }
 }
 if(recf==0)
 {
  statusbar("Customer Not Checked In . . .");
  getch();
  return;
  }
 gotoxy(10,8);
 cprintf("Customer Name :-> ");
 printf("%s",c.name);
 gotoxy(45,8);
 cprintf("Room No. :->");
 printf("%d",c.rno);
 statusbar("(1)Breakfast (2)Lunch (3)Dinner (4)Misc. (0)Back");
 strcpy(fd.cid,cid);
 fd.no=c.rno;
 fd.bfast=0.0;
 fd.lunch=0.0;
 fd.dinner=0.0;
 fd.misc=0.0;
 while(1)
 {
 gotoxy(10,12);
 cprintf("                                      ");
 gotoxy(10,10);
 cprintf("Enter your Choice . . .                         ");
 gotoxy(38,10);
 scanf("%d",&res);
 if(res!=0)
 {
 gotoxy(10,12);
 cprintf("Enter the amount                      ");
 gotoxy(30,12);
 scanf("%f",&amt);
 }
 switch(res)
 {
  case 0: fwrite(&fd,sizeof(fd),1,foodptr);
	  fclose(foodptr);
	  return;
  case 1: fd.bfast+=amt;
	  break;
  case 2: fd.lunch+=amt;
	  break;
  case 3: fd.dinner+=amt;
	  break;
  case 4: fd.misc+=amt;
	  break;
  }
 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -