航空订票系统php,C++版数据结构航空订票系统源代码.doc

C++版数据结构航空订票系统源代码.doc

#ifndef _FLIGHT_H_#define _FLIGHT_H_#includeusing namespace std;struct node{int id;char start[20];char over[20];float s_time;float o_time;int price;float sale;int ticket;struct node *next;};struct people{char name[20];char passpart[20];int ticket;int id;int number;struct people *next;

};

class fly{public:void add();node* read();int select();void update();void update_ticket(int id,int u_id);ofstream we;ifstream re;

private:node *head;

};

class user:public fly{public:int add();int insert();void dele();int user_id;

};#endif#include"iostream"#include"flight.h"#include"fstream"using namespace std;

void fly::add(){int i;node *p=new node;node *s,*n;head=p;we.open("flight.txt",ios_base::app|ios_base::binary);cout<>p->id>>p->start>>p->over>>p->s_time>>p->o_time>>p->price>>p->sale>>p->ticket;while(p!=NULL){cout<>i;if(i==1){s=new node;cin>>s->id>>s->start>>s->over>>s->s_time>>s->o_time>>s->price>>s->sale>>s->ticket;p->next=s;p=s;p->next=NULL;}else{p->next=NULL;p=p->next;}}n=head;while(n!=NULL){we.write(reinterpret_cast(n),sizeof(struct node));n=n->next;}we.close();cout<

node* fly::read(){re.open("flight.txt",ios_base::binary|ios_base::in);node *h,*s,*p;h=new node;p=new node;

p->next=NULL;re.read(reinterpret_cast(p),sizeof(struct node));h->next=p;while(!re.eof()){s=new node;re.read(reinterpret_cast(s),sizeof(struct node));p->next=s;p=s;p->next=NULL;}re.close();return h;

}

int fly::select(){node *p,*h;h=read();p=h->next;int i;cout<>i;if(i==1){cout<>i;for(;;){if(p->id==i){cout<id<sta

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值