标题:我的课程设计成果---航空售票系统
只看楼主
汶潭水清
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2006-11-11
 问题点数:0 回复次数:23 
我的课程设计成果---航空售票系统

/* 航空客运订票系统
问题描述
航空客运订票的业务活动包括:查询航线、客票预订和办理退票等。设计一个航空客运订票系统,以使上述业
务可以借助计算机完成。
要求
每条航线所涉及的信息有:终点站名、航班号、飞机号、飞行周日(星期几)、乘员定额、余票量、已订票的
客户名单(包括名字、订票量、舱位等级1、2、3)以及等候替补的客户名单;
系统实现的功能如下:
通过此系统可以实现如下功能:
录入:可以录入航班情况(数据可以存储在一个数据文件中,数据结构、具体数据自定)
查询:可以查询某个航线的情况(如,输入航班号,查询起降时间,起飞抵达城市,航班票价,票价折扣,确
定航班是否满仓);可以输入起飞抵达城市,查询飞机航班情况;
订票:(订票情况可以存在一个数据文件中,结构自己设定)可以订票,如果该航班已经无票,可以提供相关
可选择航班;
退票: 可退票,退票后修改相关数据文件;客户资料有姓名,证件号,订票数量及航班情况,订单要有编号。
修改航班信息:当航班信息改变可以修改航班数据文件
*/
#include<iostream.h>
#include<stdio.h>
#include<string.h>
#include<fstream.h>
#include<windows.h>
class daytime
{
public:
int weekday;
int hour;
int minute;
daytime()
{
weekday=hour=minute=0;
}
~daytime()
{}
};

class samepart
{
public:
char begcity[20]; // 起点城市
char arrivecity[20]; // 终点城市
char hangbancode[10]; // 航班编号
int flycode; // 飞机号
daytime lefttime; // 起飞时间
daytime arrivetime; // 到达时间
samepart()
{
strcpy(begcity,"");
strcpy(arrivecity,"");
strcpy(hangbancode,"");
strcpy(hangbancode,"");
flycode=0;
}
~samepart()
{}
};
class seat
{
public:
int chars;
double price;
int leftseat;
int position; // 座位号
seat()
{
chars=leftseat=position=0;
price=0;
}
~seat()
{}

};

class guestmessage:public samepart
{
public:
int sum;
long ID; // 证件号
int linedata; // 订票编号
char name[20];
int total; // 订票总数
int dengji;
int seats[10];
guestmessage *next;
guestmessage()
{
for(int i=0;i<10;i++)
seats[i]=0;
ID=linedata=0;
strcpy(name,"");
};


~guestmessage()
{
};

};

class blackseat
{
public:
int counter;
char hangbancode[10];
int flycode;
int chars;
int position;
blackseat *next;
blackseat()
{
strcpy(hangbancode,"");
flycode=0;
chars=0;
position=0;
counter=0;
}
};

struct operater // 机场工作人员姓名与工作密码
{
char code[20];
char name[20];

};
class flymessage:public samepart
{
public:
int counter;
int maxseat; // 最大容量
double count; // 打折数
seat seats[4];
bool empty; // 是否满舱
int didbook; // 已经订票人数

flymessage *next;

flymessage()
{
maxseat=didbook=0;
empty=false;
count=0.0;

};
~flymessage()
{};
};

istream & operator>>(istream &in,flymessage &flymess) //重载运算符>>
{
in>>flymess.hangbancode;
in>>flymess.flycode;
in>>flymess.begcity;
in>>flymess.arrivecity;
in>>flymess.count;
in>>flymess.didbook;
in>>flymess.maxseat;
in>>flymess.lefttime.weekday;
in>>flymess.lefttime.hour;
in>>flymess.lefttime.minute;
in>>flymess.arrivetime.weekday;
in>>flymess.arrivetime.hour;
in>>flymess.arrivetime.minute;
for(int i=1;i<4;i++)
{
in>>flymess.seats[i].leftseat;
in>>flymess.seats[i].price;
}

return in;
}

ostream & operator <<(ostream &os,flymessage &flymess) //重载运算符<<
{
os<<flymess.hangbancode<<'\t';
os<<flymess.flycode<<'\t';
os<<flymess.begcity<<'\t';
os<<flymess.arrivecity<<'\t';
os<<flymess.count<<'\t';
os<<flymess.didbook<<'\t';
os<<flymess.maxseat<<'\t';
os<<flymess.lefttime.weekday<<" ";
os<<flymess.lefttime.hour<<" ";
os<<flymess.lefttime.minute<<" ";
os<<flymess.arrivetime.weekday<<" ";
os<<flymess.arrivetime.hour<<" ";
os<<flymess.arrivetime.minute<<'\t';
for(int i=1;i<4;i++)
{
os<<flymess.seats[i].leftseat<<" ";
os<<flymess.seats[i].price<<'\t';
}
os<<endl;
return os;

}

istream & operator >>(istream &in,guestmessage &guest) //重载运算符>>
{
in>>guest.hangbancode;
in>>guest.flycode;
in>>guest.begcity;
in>>guest.arrivecity;
in>>guest.lefttime.weekday;
in>>guest.lefttime.hour;
in>>guest.lefttime.minute;
in>>guest.arrivetime.weekday;
in>>guest.arrivetime.hour;
in>>guest.arrivetime.minute;
in>>guest.ID;
in>>guest.name;
in>>guest.linedata;
in>>guest.total;
in>>guest.dengji;

return in;

}


ostream & operator<<(ostream &os,guestmessage &guest) //重载运算符<<
{
os<<guest.hangbancode<<'\t';
os<<guest.flycode<<'\t';
os<<guest.begcity<<'\t';
os<<guest.arrivecity<<'\t';
os<<guest.lefttime.weekday<<" ";
os<<guest.lefttime.hour<<" ";
os<<guest.lefttime.minute<<'\t';
os<<guest.arrivetime.weekday<<" ";
os<<guest.arrivetime.hour<<" ";
os<<guest.arrivetime.minute<<'\t';
os<<guest.ID<<'\t';
os<<guest.name<<'\t';
os<<guest.linedata<<'\t';
os<<guest.total<<'\t';
os<<guest.dengji;
os<<endl;

return os;

}
istream & operator << (istream &in,blackseat &blackst)
{
in>>blackst.chars;
in>>blackst.hangbancode;
in>>blackst.flycode;
in>>blackst.position;
return in;
}
ostream & operator>>(ostream &os,blackseat &blackst)
{
os<<blackst.chars<<'\t';
os<<blackst.hangbancode<<'\t';
os<<blackst.flycode<<'\t';
os<<blackst.position<<endl;
return os;
}


//------------------------------------------------------------------------------------------
void inifiledata() // 初始化航班信息文件、查询索引表文件的数据
{
fstream datafile1,datafile2,datafile3,datafile4;

datafile1.open("航班的基本信息数据.dat",ios::out);
if(!datafile1)
cout<<"航班的基本信息数据.dat文件不存在!"<<endl;
else
datafile1<<0<<endl;
datafile1.close();

datafile2.open("客户信息库.dat",ios::out);
if(!datafile2)
cout<<"客户信息库.dat文件不存在!"<<endl;
else
datafile2<<0<<endl;
datafile2.close();

datafile3.open("已订票的客户座位信息.dat",ios::out);
if(!datafile3)
cout<<"已订票的客户座位信息文件不存在!"<<endl;
datafile3<<0<<endl;
datafile3.close();

datafile4.open("退票的位子信息.txt",ios::out);
if(!datafile4)
cout<<"退票后的空位文件不存在"<<endl;
else
datafile4<<0<<endl;
datafile4.close();
system("cls");
cout<<"所有数据文件已经初始化!"<<endl;
}


//-----------------------------------------------------------------------------------------
void savealldata(flymessage *hangban) //将工作人员所修改的数据保存
{


fstream hangbanfile;
flymessage *p;
p=hangban->next;
hangbanfile.open("航班的基本信息数据.dat",ios::out);
hangbanfile<<hangban->counter<<endl;
if(hangban->counter==1)
hangbanfile<<*hangban;
else
{
while(p!=NULL)
{
hangbanfile<<*p;
p=p->next;
}
}
hangbanfile.flush();
hangbanfile.close();
cout<<"以上信息数据已保存到磁盘中!"<<endl;
}

flymessage *readalldata() // 从文件中读取航班信息数据
{
fstream hangbanfile;
flymessage *p,*head,*q;
q=head=new flymessage;
head->next=NULL;
hangbanfile.open("航班的基本信息数据.dat",ios::in);
hangbanfile>>head->counter;
if(head->counter==0)
{
cout<<"文件中没有任何数据"<<endl;
return head;
}
for(int i=0;i<head->counter;i++)
{
p=new flymessage;
p->next=NULL;
q->next=p;
q=p;
hangbanfile>>*p;

}
hangbanfile.flush();
hangbanfile.close();
return head;
}
//---------------------------------------------------------------------------------------
bool writemessage() // 录入信息,建立数据文件
{

flymessage *hangban,*p,*q,*s;
double ct;
char ach[20],bch[20],ch,hbd[10];
int fcd,mst;
seat st[4];
daytime lefttime,arrivetime;
cout<<"请输入航班起点城市名:";
cin>>bch;
cout<<"请输入航班到达城市名:";
cin>>ach;
cout<<"请输入航班号:";
cin>>hbd;
cout<<"请输入飞机号:";
cin>>fcd;
cout<<"请输入改航班的最大容量:";
cin>>mst;
cout<<"请输入该飞机"<<bch<<"起飞时间:星期 小时 分钟";
cin>>lefttime.weekday>>lefttime.hour>>lefttime.minute;
cout<<"请输入该飞机到达"<<ach<<"的时间:星期 小时 分钟";
cin>>arrivetime.weekday>>arrivetime.hour>>arrivetime.minute;
for(int i=1;i<4;i++)
{
st[i].chars=i;
cout<<"请输入"<<i<<"等舱的价格票价:";
cin>>st[i].price;
cout<<"请输入"<<i<<"等舱的剩余量:";
cin>>st[i].leftseat;
}
cout<<"请输入航线的打折情况:";
cin>>ct;
hangban=new flymessage;
hangban->didbook=0;
strcpy(hangban->begcity,bch);
strcpy(hangban->arrivecity,ach);
hangban->flycode=fcd;
strcpy(hangban->hangbancode,hbd);
hangban->maxseat=mst;
hangban->lefttime.weekday=lefttime.weekday;
hangban->lefttime.hour=lefttime.hour;
hangban->lefttime.minute=lefttime.minute;
hangban->arrivetime.weekday=arrivetime.weekday;
hangban->arrivetime.hour=arrivetime.hour;
hangban->arrivetime.minute=arrivetime.minute;
hangban->count=ct;
for( i=1;i<4;i++)
{
hangban->seats[i].chars=i;
hangban->seats[i].price=st[i].price;
hangban->seats[i].leftseat=st[i].leftseat;
}

hangban->empty=true;
s=p=new flymessage;

p=readalldata();
q=p->next;
if(p->next==NULL)
{
hangban->counter=1;
savealldata(hangban);
}
else
{

while(q!=NULL)
{
s->next=q;
s=q;
q=q->next;

}
s->next=hangban;
hangban->next=NULL;
p->counter++;
savealldata(p);
}
cout<<"是否继续录入y/n?"<<endl;
cin>>ch;
while(1)
{
if((ch=='y')||(ch=='Y'))
return true;
else if((ch=='n')||(ch=='N'))
return NULL;
else
{
cout<<"输入错误,请重新输入";
cin>>ch;
}
}

}

搜索更多相关主题的帖子: 订票 航空 课程 系统 计算机 
2006-12-30 11:56
汶潭水清
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2006-11-11
得分:0 

//----------------------------------------------------------------------------------
void changecode() // 管理人员修改密码
{
fstream change;
operater administ;
cout<<"请输入你的新用户名: ";
cin>>administ.name;
cout<<"请输入你的新密码: ";
cin>>administ.code;
change.open("管理员密码文件.dat",ios::in|ios::out|ios::binary);
if(!change)
{
cout<<"修改密码出错! 修改失败!"<<endl;

}
change.write((char*)(&administ),sizeof(operater));
change.flush();
change.close();
system("cls");
}

//------------------------------------------------------------------------------------
operater getcode() // 在文件中读取密码,与用户输入的密码核对
{
fstream fin;
operater admini;
fin.open("管理员密码文件.dat",ios::in);
fin.read((char*)(&admini),sizeof(operater));
fin.close();
return admini;
}

//----------------------------------------------------------------------------------------
void savealldatatoguest(guestmessage *guest)
{
fstream guestdata;
guestmessage *p;
p=guest->next;
guestdata.open("客户信息库.dat",ios::out);
guestdata<<guest->sum<<endl;
if(guest->sum==1)
guestdata<<*guest;
else
{

while(p!=NULL)
{
guestdata<<*p;
p=p->next;
}
}
guestdata.flush();
guestdata.close();
cout<<"信息已经保存在了客户信息库了!"<<endl;

}

guestmessage *readguest()
{
fstream guestfile;
guestmessage *guest,*p,*q;
q=guest=new guestmessage;
guest->next=NULL;
guestfile.open("客户信息库.dat",ios::in);
guestfile>>guest->sum;
if(guest->sum==0)
return guest;
else
for(int i=0;i<guest->sum;i++)
{
p=new guestmessage;
p->next=NULL;
q->next=p;
q=p;
guestfile>>*p;

}
guestfile.flush();
guestfile.close();
return guest;
}

void showmessage(flymessage *p)
{
cout<<"航班号 : "<<p->hangbancode<<" 飞机号: "<<p->flycode<<endl;
cout<<"**************************"<<endl;
cout<<"营运时间: 每周"<<p->lefttime.weekday<<" "<<p->lefttime.hour<<"点"<<p->lefttime.minute<<"分,从 "<<p->begcity<<" 起飞,到达 "<<p->arrivecity<<" 的时间是 周"<<p->arrivetime.weekday<<" "<<p->arrivetime.hour<<"点"<<p->arrivetime.minute<<"分"<<endl;
cout<<"********************************************************************"<<endl;
cout<<"票价打 "<<p->count<<" 折. "<<endl;
cout<<"**************************"<<endl;
cout<<"一等舱的剩余量为: "<<p->seats[1].leftseat<<" 一等舱票价为 "<<p->seats[1].price<<endl;
cout<<"二等舱的剩余量为: "<<p->seats[2].leftseat<<" 二等舱票价为 "<<p->seats[2].price<<endl;
cout<<"三等舱的剩余量为: "<<p->seats[3].leftseat<<" 三等舱票价为 "<<p->seats[3].price<<endl;
cout<<endl;
}
//---------------------------------------------------------------------------------
void chaxun() // 客户查询信息
{
fstream hangban,name,citye;
int a;
flymessage *flymess,*p;
guestmessage *guest,*q;
CX: cout<<"请选择查询方法 1 按航班号查询, 2 按姓名查询, 3按抵达城市名查询"<<endl<<"你选择的是: ";
cin>>a;
if(a==1)
{
char hangbancode[10];
int flycode;
cout<<"请你输入你要查询的航班号: ";
cin>>hangbancode;
cout<<endl;
cout<<"请输入你要查询的飞机号: ";
cin>>flycode;
flymess=new flymessage;
flymess=readalldata();

p=flymess->next;
while(p!=NULL)
{
if((!strcmp(p->hangbancode,hangbancode))&&(p->flycode==flycode))
{
showmessage(p);
break;
}
else
p=p->next;
}
system("cls");
if(p==NULL)
cout<<"你所查询的信息不存在!"<<endl;

}
else if(a==2)
{
char names[20];
int i=0;
cout<<"你要查询客户的姓名为:";
cin>>names;
cout<<"名为"<<names<<"的客户有以下"<<endl;
guest=readguest();
q=guest->next;
while(q!=NULL)
{
if(!strcmp(q->name,names))
{
cout<<endl;
cout<<"姓名: "<<q->name<<" 客户ID: "<<q->ID<<endl;
cout<<"所乘航班的航班号为: "<<q->hangbancode<<" 飞机号: "<<q->flycode<<endl;
cout<<"舱位等级: "<<q->dengji<<" 预订票数: "<<q->total<<endl;
cout<<"座位:"<<endl;
for(int set=0;set<q->total;set++)
cout<<q->seats[set]<<"号 ";
cout<<endl;
cout<<"航班于周"<<q->lefttime.weekday<<"日"<<q->lefttime.hour<<"时"<<q->lefttime.minute<<"分, 从"<<q->begcity<<" 飞往 "<<q->arrivecity<<",到达时间为: 周"<<q->arrivetime.weekday<<"日"<<q->arrivetime.hour<<"时"<<q->arrivetime.minute<<"分"<<endl;
cout<<endl;
i++;
}
q=q->next;

}
if(i==0)
cout<<"你查找的姓名不存在与数据库中!"<<endl;

}
else if(a==3)
{
char cityarr[20],citybeg[20];
flymessage *lookup,*p;
cout<<"请输入你想查询飞机起飞的城市: ";
cin>>citybeg;
cout<<"请输入你想查询飞机抵达的城市: ";
cin>>cityarr;
cout<<endl;
int n=0;
lookup=readalldata();
p=lookup->next;
while(p!=NULL)
{
if((!strcmp(p->arrivecity,cityarr))&&(!strcmp(p->begcity,citybeg)))
{
showmessage(p);
n++;
cout<<endl;
}
p=p->next;
}
if(n==0)
cout<<"对不起,你查询的城市没有直达航班!"<<endl;
}
else
{
cout<<"输入错误,请重新输入"<<endl;
goto CX;
}

}

blackseat *getblack()
{
blackseat *head,*p,*q;
fstream fin;
q=head=new blackseat;
head->next=NULL;
fin.open("退票的位子信息.txt",ios::out);
fin>>head->counter;
for(int i=0;i<head->counter;i++)
{
p=new blackseat;
p->next=NULL;
fin>>*p;
q->next=p;
q=p;
}
fin.close();
return head;
}


void setblack(blackseat * hblack)
{
fstream fout;
blackseat *p;
p=hblack->next;
fout.open("退票的位子信息.txt",ios::out);
fout<<hblack->counter;
if(hblack->counter==1)
fout<<*hblack;
else
{
while(p!=NULL)
{
fout<<*p;
p=p->next;
}
}
fout.flush();
fout.close();
}
//------------------------------------------------------------------------------------
void bookticket() // 客户订票操作
{

flymessage *p,*lookup,*front;
fstream bookt,reflesh;
int choice;
int getcode2;
char city[20],getcode1[10];
fstream flashdata,flashdata2;
char nch[20];
int dj,id,tt;
B: cout<<"请输入你订票方式 1 为按航班号和飞机号订票,2 为按抵达城市订票"<<endl;
cin>>choice;

switch(choice)
{
case 1:
{
cout<<"请你输入你想预定航班的航班号: ";
cin>>getcode1;
cout<<"请输入飞机号: ";
cin>>getcode2;

break;
}
case 2:
{

cout<<"请你输入你想预定航班抵达的城市!"<<endl<<"你输入的是: ";
cin>>city;
lookup=readalldata();
p=lookup->next;
while(p!=NULL)
{
if(!strcmp(p->arrivecity,city))
showmessage(p);
p=p->next;
}
cout<<"请在以上的航班中选取你想预订的航班的航班号: ";
cin>>getcode1;
cout<<"输入飞机号: ";
cin>>getcode2;

break;
}
default :
{
cout<<"输入错误,请重新输入!"<<endl;
goto B;
}
}
cout<<"你所选择的是: "<<endl;
guestmessage *guest,*s,*hguest,*pre;
guest=new guestmessage;

lookup=readalldata();
p=lookup;
front=lookup->next;
while(front!=NULL)
{
p->next=front;
p=front;
if((!strcmp(front->hangbancode,getcode1))&&(front->flycode==getcode2))
{
break;
}
front=front->next;
}

cout<<"请输入客户的姓名:";
cin>>nch;
cout<<"请输入客户的ID号:";
cin>>id;
sb: cout<<"请输入客户要求的机舱等级,1 为一等舱,2为二等舱,3为三等舱 :";
cin>>dj;
if((dj<0)||(dj>4))
{
cout<<"请重新输入!";
goto sb;
}

bool full=true;
while(full)
{
if(p->seats[dj].leftseat>0)
full=false;
else
{
cout<<dj<<"等舱已满,请选择另外的座舱!"<<endl;
goto sb;
}
}
cout<<"客户定票数:";
cin>>tt;
guest->dengji=dj;
guest->linedata=p->didbook+1;
blackseat *bseat,*x;
bseat=new blackseat;
bseat->next=NULL;
bseat=getblack();
x=bseat->next;
int il;
cout<<"请付: "<<p->seats[dj].price*tt<<" 元, 谢谢!"<<endl;
if(bseat->next!=NULL)
{
int j=0;
while(x!=NULL)
{
if((!strcmp(getcode1,x->hangbancode))&&(getcode2==x->flycode)&&(j<tt))
guest->seats[j++]=x->position;
else
x=x->next;
}
if(--j<tt-1)
{
for(int n=0;n<tt-j+1;n++)
guest->seats[n]=++p->didbook;
}
}
else
{
int didbuy=p->didbook;
for(int i=0;i<tt;i++)
{
if(didbuy<(p->maxseat+1))
guest->seats[i]=++p->didbook;
else
{
cout<<"对不起,票已售空,只能售"<<i+1<<"张票给您!"<<endl;
break;
}
il=i+1;
}
switch(dj)
{
case 1:
{
p->seats[1].leftseat-=il;
break;
}
case 2:
{
p->seats[2].leftseat-=il;
break;
}
case 3:
{
p->seats[3].leftseat-=il;
break;
}
default:
{
p->seats[3].leftseat-=il;

}
}
}
guest->total=tt;
strcpy(guest->name,nch);
guest->ID=id;
strcpy(guest->begcity,p->begcity);
strcpy(guest->arrivecity,p->arrivecity);
strcpy(guest->hangbancode,p->hangbancode);
guest->flycode=p->flycode;

guest->lefttime.weekday=p->lefttime.weekday;
guest->lefttime.hour=p->lefttime.hour;
guest->lefttime.minute=p->lefttime.minute;
guest->arrivetime.weekday=p->arrivetime.weekday;
guest->arrivetime.hour=p->arrivetime.hour;
guest->arrivetime.minute=p->arrivetime.minute;
guest->next=NULL;

pre=hguest=new guestmessage;
hguest=readguest();
s=hguest->next;
if(hguest->next==NULL)
{
guest->sum=1;
savealldatatoguest(guest);
}
else
{
while(s!=NULL)
{
pre->next=s;
pre=s;
s=s->next;
}
pre->next=guest;
hguest->sum++;
savealldatatoguest(hguest);
lookup->counter++;
}
savealldata(lookup);
system("cls");
cout<<"预订成功!"<<endl;
cout<<"你预定的信息如下:"<<endl;
cout<<"姓名: "<<guest->name<<" ID: "<<guest->ID<<" 舱位: "<<dj<<endl;
cout<<"座位:"<<endl;
for(int set=0;set<guest->total;set++)
cout<<guest->seats[set]<<"号 ";
cout<<"所乘航班班次: "<<p->hangbancode<<" 于"<<p->lefttime.hour<<"时"<<p->lefttime.minute<<"分"<<"从"<<p->begcity<<"飞往"<<p->arrivecity<<",到达时间为: "<<p->arrivetime.hour<<"时"<<p->arrivetime.minute<<"分."<<endl<<"请准时登机!";
cout<<endl;


}


2006-12-30 11:58
汶潭水清
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2006-11-11
得分:0 

//-----------------------------------------------------------------------------------
void putbackticket() // 客户退票操作
{
char chioce,hangbancode[10];
int flycode;
int total;
char name[20];
long ID;
blackseat *hblst,*blst,*bseat,*pblst;
guestmessage *guest,*headguest,*pguest,*temp;
cout<<"是否确定要退票? y/n?"<<endl;
cin>>chioce;
if((chioce=='n')||(chioce=='N'))
return;
else
{
cout<<"请输入你的航班号: ";
cin>>hangbancode;
cout<<"请输入你的航班飞机号 ";
cin>>flycode;
cout<<"请输入你的名字"<<endl;
cin>>name;
cout<<"请输入你的ID号"<<endl;
cin>>ID;
guest=headguest=new guestmessage;
headguest=readguest();
pguest=headguest->next;
bseat=hblst=new blackseat;
hblst=getblack();
blst=hblst->next;
while(blst!=NULL)
{
bseat->next=blst;
blst=blst->next;
}
while(pguest!=NULL)
{
if((!strcmp(pguest->hangbancode,hangbancode))&&(pguest->flycode==flycode)&&(pguest->ID==ID)&&strcmp(pguest->name,name))
{
temp=pguest;
total=temp->total;
int i=0;
while(i<total)
{

pblst=new blackseat;
pblst->counter=1;
strcpy(pblst->hangbancode,temp->hangbancode);
pblst->flycode=temp->flycode;
pblst->chars=temp->dengji;
pblst->position=temp->seats[i];
++(hblst->counter);
i++;
}
guest->next=pguest->next;
delete temp;
break;
}
else
{
guest->next=pguest;
guest=pguest;
pguest=pguest->next;
}

}
setblack(hblst);

savealldatatoguest(headguest);
cout<<"退票成功!"<<endl;
}

}

//---------------------------------------------------------------------------------
void changemessage() // 工作人员修改信息,核对工作人员是否有权限修改信息
{
bool p=true;
p=writemessage();
while(p)
p=writemessage(); //修改信息操作
}
//----------------------------------------------------------------------------------
void main()
{
ofstream hangbanfile;
int get1;
int get2;
cout<<"*******************************************************************************"<<endl;
cout<<"* *"<<endl;
cout<<"* 航空订票查询退票系统已经运行!欢迎使用! *"<<endl;
A: cout<<"*******************************************************************************"<<endl;
cout<<"* 请选择服务种类: *"<<endl;
cout<<"* *"<<endl;
cout<<"* 1 客户定票,2航班信息查询,3客户退票, 4工作人员修改数据信息, 5退出系统 *"<<endl;
cout<<"*******************************************************************************"<<endl;
cout<<"你选择的是: ";
cin>>get1;
switch(get1)
{
case 1:
{
bookticket();
goto A;
}
case 2:
{
chaxun();
goto A;
}
case 3:
{
putbackticket();
goto A;
}
case 4:
{
char a[20],b[20];
operater adminis;
cout<<"请输入你的用户名 ......."<<endl;
cin>>a;
cout<<"请输入你的密码......."<<endl;
cin>>b;
adminis=getcode();
if(!strcmp(a, adminis.name)&&!strcmp(b,adminis.code))
{
system("cls");
H: cout<<"密码审核通过!"<<endl;
cout<<"请你选择修改信息种类 :"<<endl;
cout<<" * 1 修改工作密码"<<endl;
cout<<" * 2 重新设置航班信息"<<endl;
cout<<" * 3 销毁以前的所有数据,重新初始化"<<endl;
cout<<"******************************"<<endl;
cin>>get2;
switch(get2)
{
case 1:
{
changecode();
goto A;
}
case 2:
{
changemessage();
goto A;
}
case 3:
{
char choice;
cout<<"请慎重考虑,执行该操作后,航班信息数据将全部丢失,是否销毁 y/n?"<<endl;
cin>>choice;
if(choice=='y'||choice=='Y')
{
inifiledata();
goto A;
}
else break;
}

default:
{
cout<<"输入错误,请重新输入!"<<endl;
goto H;
}
}
}
else
{
cout<<"非法用户,为了数据的安全,系统结束!"<<endl;
goto END;
}
}
case 5:
{
break;

}

default:
{
cout<<"您输入的代号,系统无法识别,请重新输入.........."<<endl;
goto A;
}

}
END:
cout<<"系统已退出..........."<<endl;
}


要先用上面的修改密码的函数建立密码文件,再进入修改航班信息的菜单进行录入航班信息,才能进行其他的操作

写的不好,很多知识是临时学的,时间也很紧,会有很多缺陷,不要见怪,呵呵!


2006-12-30 11:59
☆註⊙諨☆
Rank: 1
等 级:新手上路
帖 子:73
专家分:0
注 册:2006-10-7
得分:0 
很厉害啦...
结构什么的都很好哦...

2006-12-30 14:33
cyuyansji
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-6-14
得分:0 
2007-06-14 10:16
cyzyh88
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2007-5-23
得分:0 
有没有C版!?

2007-06-14 13:07
qqwuming
Rank: 1
等 级:新手上路
威 望:1
帖 子:48
专家分:0
注 册:2007-5-31
得分:0 

2007-06-15 13:36
夜猫子
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2007-3-11
得分:0 
对..这是c
++得把..
2007-06-22 11:17
小小R
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2007-6-29
得分:0 
高手~
2007-06-29 14:32
wz_03rj4
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-8-16
得分:0 
要出道了!
2007-08-16 18:30



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-113154-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.002964 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved