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

📄 gongneng.c

📁 飞机票的预定系统
💻 C
字号:
#include "bianliang.h"
#include "xinxi.h"
#include "main.h"
#include "yonghu.h"
#include "piao.h"

// // // // // // // // // // 管理员功能界面 // // // // // // // // // // 
void adgn(emploe em1[10],int k)
{
	FILE *f;
	int n,m;
	emploe em2[10];
	system("cls");
loop1:printf("\n\t\t请选择功能:\t\t\t\t\t\t管理员");
	  printf("\n________________________________________________________________________________");
	  printf("\n\n\t\t1.登录航班");
	  printf("\n\t\t2.查询航班\n");
	  printf("\n\t\t3.订票");
	  printf("\n\t\t4.退票\n");
	  printf("\n\t\t5.添加用户");
	  printf("\n\t\t6.修改权限\n");
	  printf("\n\t\t7.删除用户");
	  printf("\n\t\t8.修改密码\n");
	  printf("\n\t\t9.注销");
	  printf("\n\t\t0.退出\n");
	  printf("\n\n================================================================================");
	  n=-1;
	  fflush(stdin);
	  scanf("%d",&n);
	  switch(n)
	  {
// // // // // // // // // //   登 录 航 班 信 息   // // // // // // // // // // 
	  case 1:
loop2:	  system("cls");
		  printf("\n\t\t请选择功能:\t\t\t\t\t\t管理员");
		  printf("\n________________________________________________________________________________");
		  printf("\n\n\n\t\t1.输入航班信息");
		  printf("\n\n\n\t\t2.删除航班信息");
		  printf("\n\n\n\t\t0.返回");
		  fflush(stdin);
		  scanf("%d",&m);
		  switch(m) 
		  {
		  case 1:
			  system("cls");
			  input(em1,k);
			  system("cls");
			  goto loop2;
			  break;
		  case 2:
			  system("cls");
			  delair(em1,k);
			  system("cls");
			  goto loop2;
			  break;
		  case 0:
			  system("cls");
			  goto loop1;
			  break;
		  default:
			  system("cls");
			  printf("\n\t\t\t\t\t\t\t\t\t管理员");
			  printf("\n________________________________________________________________________________");
			  printf("\n\n\n\n\n\n\n\t\t\t您的输入不符合要求~");
			  printf("\n\n\n\n\n\n\n\n\n\n\n================================================================================");
			  printf("\n\t\t\t\t(按任意键返回)");
			  fflush(stdin);
			  n=getch();
			  system("cls");
			  goto loop2;
		  }
		  
		  break;
// // // // // // // // // //   查 询 航 班 信 息   // // // // // // // // // // 
	  case 2:
		  system("cls");
		  output(em1,k);
		  system("cls");
		  goto loop1;
		  break;
// // // // // // // // // //   订  票   // // // // // // // // // // 
	  case 3:
		  system("cls");
		  book(em1,k);
		  goto loop1;
		  break;
// // // // // // // // // //   退  票   // // // // // // // // // //
	  case 4:
		  system("cls");
		  refund(em1,k);
		  goto loop1;
		  break;
// // // // // // // // // //   添 加 新 用 户   // // // // // // // // // //
	  case 5:
		  system("cls");
		  add(em1,k);
		  printf("\n\n\t\t新用户注册成功!!");
		  printf("\n\n\n\n================================================================================");
		  printf("\n\t\t\t\t(按任意键继续)");
		  fflush(stdin);
		  n=getch();
		  system("cls");
		  goto loop1;
		  break;
// // // // // // // // // //   修 改 权 限   // // // // // // // // // //
	  case 6:
		  system("cls");
		  power(em1,k);
		  system("cls");
		  goto loop1;
		  break;
// // // // // // // // // //   删 除 用 户   // // // // // // // // // //
	  case 7:
		  system("cls");
		  del(em1,k);
		  system("cls");
		  goto loop1;
		  break;
// // // // // // // // // //   修 改 密 码   // // // // // // // // // // 
	  case 8:
		  changepwd(em1,k);
		  printf("\n\n\n\n\t\t您的密码修改成功!!");
		  printf("\n\n\n\n\n\n\n\n================================================================================");
		  printf("\n\t\t\t\t(按任意键继续)");
		  fflush(stdin);
		  n=getch();
		  system("cls");
		  goto loop1;
		  break;
// // // // // // // // // //     注  销    // // // // // // // // // // 
	  case 9:
		  system("cls");
		  if ((f=fopen("pwd.dat","r"))==NULL)
		  {
			  printf("File Can't be find!\n");
		  }
		  else
		  {
			  fread(&em2,sizeof(em2),1,f);
		  }
		  fclose(f);

		  if ((f=fopen("pwd.dat","w+b"))==NULL)
		  {
			  printf("File Can't be find!\n");
		  }
		  else
		  {
			  em2[k].record=0;
			  em2[k].first=em1[k].first;
			  fwrite(&em2,sizeof(em2),1,f);
		  }
		  fclose(f);
		  main();
		  break;
// // // // // // // // // //     退  出     // // // // // // // // // // 
		case 0:
		  system("cls");
		  if ((f=fopen("pwd.dat","r"))==NULL)
		  {
			  printf("File Can't be find!\n");
		  }
		  else
		  {
			  fread(&em2,sizeof(em2),1,f);
		  }
		  fclose(f);

		  if ((f=fopen("pwd.dat","w+b"))==NULL)
		  {
			  printf("File Can't be find!\n");
		  }
		  else
		  {
			  em2[k].record=0;
			  em2[k].first=em1[k].first;
			  fwrite(&em2,sizeof(em2),1,f);
		  }
		  fclose(f);
		  main();
		  break;
// // // // // // // // // //  输 入 错 误  // // // // // // // // // // 
		default:
			{
				system("cls");
				printf("\n\t\t\t\t\t\t\t\t\t管理员");
				printf("\n________________________________________________________________________________");
				printf("\n\n\n\n\n\n\n\t\t\t\t您的输入不符合要求~");
				printf("\n\n\n\n\n\n\n\n\n\n\n================================================================================");
				printf("\n\t\t\t\t(按任意键返回)");
				fflush(stdin);
				n=getch();
				system("cls");
				goto loop1;
			}
	  }
}





// // // // // // // // // // 用 户 功 能 界 面 // // // // // // // // // // 

void usgn(emploe em1[10],int k)
{	
	FILE *f;
	int n;
	emploe em2[10];
	static char password1[6],password2[6],ch;
	system("cls");
loop1:printf("\n\t\t请选择功能:\t\t\t\t\t\t员工");
	  printf("\n________________________________________________________________________________");
	  printf("\n\n\n\n\t\t1.查询航班");
	  printf("\n\t\t2.修改密码");
	  printf("\n\n\t\t3.订票");
	  printf("\n\t\t4.退票");
	  printf("\n\n\t\t9.注销");
	  printf("\n\t\t0.退出");
	  printf("\n\n\n\n\n\n\n================================================================================");
	  fflush(stdin);
	  scanf("%d",&n);
	  switch(n)
	  {
// // // // // // // // // //   查 询 航 班 信 息   // // // // // // // // // // 
	  case 1:
		  system("cls");
		  output(em1,k);
		  system("cls");
		  goto loop1;
		  break;
// // // // // // // // // //   修 改 密 码   // // // // // // // // // // 
	  case 2:
		  changepwd(em1,k);
		  printf("\n\n\n\n\t\t您的密码修改成功!!");
		  printf("\n\n\n\n\n\n\n\n================================================================================");
		  printf("\n\t\t\t\t(按任意键继续)");
		  fflush(stdin);
		  n=getch();
		  system("cls");
		  goto loop1;
		  break;
// // // // // // // // // //   订  票   // // // // // // // // // // 
	  case 3:
		  system("cls");
		  book(em1,k);
		  goto loop1;
		  break;
// // // // // // // // // //   退  票   // // // // // // // // // // 
	  case 4:
		  system("cls");
		  refund(em1,k);
		  goto loop1;
		  break;
// // // // // // // // // //     注  销    // // // // // // // // // // 
	  case 9:
		  system("cls");
		  if ((f=fopen("pwd.dat","r"))==NULL)
		  {
			  printf("File Can't be find!\n");
		  }
		  else
		  {
			  fread(&em2,sizeof(em2),1,f);
		  }
		  fclose(f);

		  if ((f=fopen("pwd.dat","w+b"))==NULL)
		  {
			  printf("File Can't be find!\n");
		  }
		  else
		  {
			  em2[k].record=0;
			  em2[k].first=em1[k].first;
			  fwrite(&em2,sizeof(em2),1,f);
		  }
		  fclose(f);
		  main();
		  break;
// // // // // // // // // //     退  出     // // // // // // // // // // 
	  case 0:
		  system("cls");
		  if ((f=fopen("pwd.dat","r"))==NULL)
		  {
			  printf("File Can't be find!\n");
		  }
		  else
		  {
			  fread(&em2,sizeof(em2),1,f);
		  }
		  fclose(f);

		  if ((f=fopen("pwd.dat","w+b"))==NULL)
		  {
			  printf("File Can't be find!\n");
		  }
		  else
		  {
			  em2[k].record=0;
			  em2[k].first=em1[k].first;
			  fwrite(&em2,sizeof(em2),1,f);
		  }
		  fclose(f);
		  main();
		  break;
// // // // // // // // // //  输 入 错 误  // // // // // // // // // // 
	  default:
		  {
			  system("cls");
			  printf("\n\t\t\t\t\t\t\t\t\t员工");
			  printf("\n________________________________________________________________________________");
			  printf("\n\n\n\n\n\n\n\t\t\t\t您的输入不符合要求~");
			  printf("\n\n\n\n\n\n\n\n\n\n\n================================================================================");
			  printf("\n\t\t\t\t(按任意键返回)");
			  fflush(stdin);
			  n=getch();
			  system("cls");
			  goto loop1;
		  }
	  }
}

⌨️ 快捷键说明

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