導航:首頁 > 源碼編譯 > 航空系統開發源碼

航空系統開發源碼

發布時間:2022-07-07 02:31:42

❶ 航空售票 源代碼

你是NIIT班的吧,這個應該是你們的期末項目.自己做吧,不是很難的

❷ 求機票預定系統(用C語言編譯)

你會走進
你知道嗎?你知道。幾乎什麼也沒有。
而是多如道路上的石子,
未來早已經
一圈圈,綠色的雕像騎馳,就好像
他最懦弱的的存哈哈

❸ 你有機票預定系統的C#源代碼嗎我現在急需如果有的話,能發一份給我嗎 謝謝!

這是給比較復雜的系統,你只有5分是不會有人幫你弄的,去csdn上找找吧!

❹ 用C++編寫一個航空售票系統

#include<iostream>
#include<string>
#include<fstream>
#include<sstream>
using namespace std;
class Tair //通過定義一個類來定義數據錄入的函數
{
char flight[20]; char data[20];char start[20];
char finish[20];char stime[20];char ftime[20];int price;
public:
Tair()
{};
Tair(char fl[20], char D[20],char S[20],char Fin[20],char st[20],char ft[20],int pr);
friend void main(); //將主函數定義為友元函數,方便訪問類中的成員
};

Tair::Tair (char fl[20], char D[20],char S[20],char Fin[20],char st[20],char ft[20],int pr)
{
strcpy(flight,fl); //
strcpy(data,D);
strcpy(start,S);
strcpy(finish,Fin);
strcpy(stime,st);
strcpy(ftime,ft);
price=pr; //
}

void main()
{
int p=0; //全局變數,用於選擇菜單時的輸入
Tair *s[100]; //類定義的指針將所錄入的數據按類中的形式分別存儲
ofstream *file[100];
int i=0; //全局變數,用於做每個錄入數據的下標
int j=0;
int chris1=0;//用於判斷do—while語句
while(p!=6)
{
cout<<"\n************ 歡迎來到民航售票系統,請選擇您需要的操作並輸入相應數字! ***********\n";
cout<<"(1)錄入信息\n";
cout<<"(2)按起點查出所有航班的信息\n";
cout<<"(3)按終點查出所有航班的信息\n";
cout<<"(4)按日期、航班號查詢航班信息\n";
cout<<"(5)按起點站統計航班數\n";
cout<<"(6)退出\n";
do //判斷輸入指令是否正確
{
cin>>p;
if((p>=1&&p<=6))
chris1=1;
else
cout<<"指令錯誤!請重新輸入:"<<endl;
}while(chris1==0);
do
{
switch(p)
{
case 1://錄入
{
char flight[20],data[20],start[20],finish[20],stime[20],ftime[20];
int price; char c; //用於在小項中選擇是否繼續操作
do
{
cout<<"請依次輸入航班號、日期、起點站、終點站、起飛時間、到達時間、票價\n";
cin>>flight>>data>>start>>finish>>stime>>ftime>>price;
fstream outfile,infile; //作一個文本文檔在文件夾中用於顯示所錄入的數據
outfile.open("flight.txt",ios::out|ios::app); //以向文件追加寫入的方式打開文件flight.txt
if(!file)
{
cout<<"flight.txt can not open.\n";
return;
}
outfile<<"航班號:"<<flight<<" "<<"日期:"<<data<<" "<<"起點站:"<<start<<" "<<"終點站:"<<finish<<" "<<"起飛時間:"<<stime<<" "<<"到達時間:"<<ftime<<" "<<"票價:"<<price<<endl;

outfile.close();
infile.open("flight.txt",ios::in);
if(!file) //判斷文件是否打開
{
cout<<"f1.txt can not open.\n";
return;
}
char ch;
while(infile.get(ch))
cout<<ch;
cout<<endl<<endl;
infile.close();
j++;
s[i]=new Tair(flight,data,start,finish,stime,ftime,price);
i++;
cout<<"已錄入"<<i<<"條航班信息,想繼續錄入嗎(y/n)"<<endl;
cin>>c;
chris1=0;
//do
//{
if(c!='y'&&c!='n')
{
cout<<"指令錯誤!請重新輸入!"<<endl;
cin>>c;
}
//else chris1=1;
//}while(chris1==0);
}while(c=='y');
break;
}
case 2://按起點站查詢
{
char st[20];char c;int j=0;int flag;
if(i==0)
{ cout<<"系統中沒有航班信息,請先進行錄入操作!"<<endl; break; }
do
{
flag=0;
cout<<"請輸入要查詢的航班的起點站: "<<endl;
cin>>st;
cout<<"您要查詢的起點站為%c的航班信息如下:"<<st<<endl<<endl;
for(int j=0;j<i;j++)
{
if(strcmp(st,(*s[j]).start)==0)
{
flag=1;

cout<<"航班號:"<<(*s[j]).flight<<" 日期:"<<(*s[j]).data<<" 終點站:"<<(*s[j]).finish<<" 起飛時間:"<<(*s[j]).stime<<" 到達時間:"<<(*s[j]).ftime<<" 票價:"<<(*s[j]).price<<endl;
}
}
if(flag==0) cout<<"對不起,您查詢的航班信息不存在!"<<endl<<endl;
cout<<"您想繼續查詢嗎?(y/n):";
cin>>c;
if(c!='n'&&c!='y')
{
cout<<"指令錯誤!請重新輸入:"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case 3://按終點站查詢
{
char fin[20];char c;int j=0;int flag;
if(i==0)
{ cout<<"系統中沒有航班信息,請先進行錄入操作!"<<endl; break; }
do
{
flag=0;
cout<<"請輸入要查詢的航班的終點站: "<<endl;
cin>>fin;
cout<<"您要查詢的終點站為"<<fin<<"的航班信息如下:"<<endl<<endl;
for(int j=0;j<i;j++)
{
if(strcmp(fin,(*s[j]).finish)==0)
{
flag=1;

cout<<"航班號:"<<(*s[j]).flight<<" 日期:"<<(*s[j]).data<<" 起點站:"<<(*s[j]).start<<" 起飛時間:"<<(*s[j]).stime<<" 到達時間:"<<(*s[j]).ftime<<" 票價:"<<(*s[j]).price<<endl;
}
}
if(flag==0) cout<<"對不起,您查詢的航班信息不存在!"<<endl;
cout<<"您想繼續查詢嗎?(y/n):";
cin>>c;
if(c!='n'&&c!='y')
{
cout<<"指令錯誤!請重新輸入:"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case 4://按日期、航班號查詢
{
char dat[20],fli[20];char c;int j,flag;
if(i==0)
{ cout<<"系統中沒有航班信息,請先進行錄入操作!"<<endl; break; }
do
{
flag=0;
cout<<"請輸入要查詢的航班的日期和航班號: "<<endl;
cin>>dat>>fli;
cout<<"您要查詢的日期為"<<dat<<",航班號為"<<fli<<"的航班信息如下:"<<endl<<endl;
for(j=0;j<i;j++)
{
if(strcmp(dat,(*s[j]).data)==0 && strcmp(fli,(*s[j]).flight)==0)
{
flag=1;

cout<<"起點站:"<<(*s[j]).start<<" 終點站:"<<(*s[j]).finish<<" 起飛時間:"<<(*s[j]).stime<<" 到達時間:"<<(*s[j]).ftime<<" 票價:"<<(*s[j]).price<<endl;
}
}
if(flag==0) cout<<"對不起,您查詢的航班信息不存在!"<<endl;
cout<<"您想繼續查詢嗎?(y/n):";
cin>>c;
if(c!='n'&&c!='y')
{
cout<<"指令錯誤!請重新輸入:"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case 5://按起點或終點統計一周的航班數
{
int count,flag,j;
char str[20]; char c;
if(i==0)
{ cout<<"\n系統中沒有航班信息,請先進行錄入操作!"<<endl; break; }
do
{
flag=0;count=0;
cout<<"\n請輸入要統計的航班起點站:"<<endl;
cin>>str;
for(j=0;j<i;j++)
{
if(strcmp(str,(*s[j]).start)==0)
{
flag=1;
count++;
}
}
if(j>=i && flag==0)
cout<<"對不起,您查詢的航班信息不存在!"<<endl<<endl;
else
cout<<"\n您要查詢的起點站為"<<str<<"的航班數為:"<<count<<endl<<endl;
cout<<"您想繼續查詢嗎?(y/n):";
cin>>c;
if(c!='n'&&c!='y')
{
cout<<"指令錯誤!請重新輸入:"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case 6://退出
{
cout<<endl<<"********* 感謝您的使用,( ^_^ )/~~拜拜! **********"<<endl;
break;
}

}break;
}while(chris1==0);
}
}

❺ 航空公司訂票系統源代碼 要求要 c++ 來寫

#include <iostream.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>
#define m 4 //3架飛機
#define n 5 //每架飛機5張票

struct node
{
char name[21];
char id[21];
int seat,plane,date;
node *next,*pre;
};
struct wait
{
char name[21];
char id[21];
char phone[8];
int seat,plane,date,count;
wait *next,*pre;
};
struct piao
{
int seat[n+1];
};

void makenull();
void makenull_piao();
void makenull_information();
void list_menu();
void list_piao();
void makenull_wait();
void list_information();
void plane_information(node *head);
void book();
void add_information(node *head,int x,int y);
void add_wait(int x,int y);
void search_delete(int x);
void write_to_file();
void show_wait();
bool comp(node *x,node*y);

node *head1,*head2,*head3,*q;
wait *wait_head,*wait_end;
char c;
piao a[m];

void main()
{

makenull();
do
{ list_menu();
cout<<endl<<"choose an operation: ";
cin>>c;
if (c!='6')
switch(c)
{
case '0' : show_wait();break;
case '1' : {list_piao();book();}break;
case '2' : search_delete(1);break;
case '3' : list_piao();break;
case '4' : list_information();break;
case '5' : search_delete(0);break;
default : break;
}
}while(c!='6');
cout<<"Exit System ";
}
void makenull()
{
makenull_piao();
makenull_information();
makenull_wait();
}
void list_menu()
{ cout<<endl<<"";
cout<<endl<<" 菜單";
cout<<endl<<" ************************";
cout<<endl<<" * 0 . 查看排隊情況 *";
cout<<endl<<" * 1 . 訂票 *";
cout<<endl<<" * 2 . 退票 *";
cout<<endl<<" * 3 . 查看剩餘票 *";
cout<<endl<<" * 4 . 查看飛機信息 *";
cout<<endl<<" * 5 . 查看乘客信息 *";
cout<<endl<<" * 6 . 退出 *";
cout<<endl<<" ************************";
cout<<endl<<"";
}
void makenull_piao()
{
FILE *fp;
int i;
if((fp=fopen("piao.dat","r")) == NULL )
{
fp=fopen("piao.dat","w");
for (i=1;i<=m-1;i++)
fwrite(&a[i],sizeof(piao),1,fp);
fclose(fp);
fp=fopen("piao.dat","r");
}
for(i=1;i<=m-1;i++)
fread(&a[i],sizeof(piao),1,fp);
fclose(fp);
}
void makenull_information()
{
node *r;
FILE *fp;
int i,j,sum;

sum=a[1].seat[0]+a[2].seat[0]+a[3].seat[0];
fp=fopen("information.dat","r");
head1=new node;
head2=new node;
head3=new node;
head1->pre=NULL;
head1->next=NULL;
head2->pre=NULL;
head2->next=NULL;
head3->pre=NULL;
head3->next=NULL;
q=head1;
for(i=1;i<=sum;i++)
{
j=0;
r=new node;
fread(r,sizeof(node),1,fp);
q->next=r;
r->pre=q;
r->next=NULL;
q=q->next;
fclose(fp);
if(i==a[1].seat[0]+1) {
head2->next=q;
q->pre->next=NULL;
q->pre=head2;
}
if(i==a[1].seat[0]+a[2].seat[0]+1) {
head3->next=q;
q->pre->next=NULL;
q->pre=head3;
}
}
}

void makenull_wait()
{
wait *tempw;
FILE *fp;
tempw=new wait;
int i;
if((fp=fopen("wait.txt","r")) ==NULL )
{
fp=fopen("wait.txt","w");
fclose(fp);
}
wait_end=new wait;
wait_head=new wait;
wait_end->next=NULL;
wait_end->pre=NULL;
wait_head=wait_end;
wait_head->count=0;
fp=fopen("wait.txt","r");
fread(wait_head,sizeof(wait),1,fp);
for(i=1;i<=wait_head->count;i++)
{
fread(tempw,sizeof(wait),1,fp);
wait_end->next=tempw;
tempw->pre=wait_end;
tempw->next=NULL;
wait_end=tempw;
}
}

void list_piao()
{
int i,j;
for(i=1;i<=m-1;i++)
{
if(a[i].seat[0]!=n)
{
cout<<endl<<"第 "<<i<<" 架飛機剩餘的票 :"<<endl;
for(j=1;j<=n;j++)
if (a[i].seat[j]==0) cout<<" "<<j;
cout<<endl;
}
else cout<<endl<<"The "<<i<<" plane is full !"<<endl<<endl;
}
}
void list_information()
{
int x;
do {cout<<endl<<"顯示哪架飛機的信息 ? "; cin>>x;cout<<endl;}while(x<1 || x>=m);
cout<<endl<<"第 "<<x<<" 架飛機的信息如下 "<<endl;
if(x==1) plane_information(head1);
if(x==2) plane_information(head2);
if(x==3) plane_information(head3);
}

void plane_information(node *head)
{
node *q;
char ch;
int x=0;
if(head!=NULL && head->next!=NULL)
q=head->next;
else {
q=NULL;
cout<<"飛機空,無預訂票 !"<<endl;
}
while(q!=NULL)
{
cout<<endl<<"*******************"<<endl;
q->date=q->plane;
cout<<"日期 :"<<q->date<<endl;
cout<<"座位號 : "<<q->seat<<endl;
cout<<"姓名 : "<<q->name;
cout<<endl<<"ID 號 : "<<q->id;
q=q->next;x++;
if (x % 3 ==0) ch=getch();
}
cout<<endl;
}
void book()
{
int i,j,p;
cout<<endl<<"請選擇地點:(1、2、3) ";
do {
cin>>i;
if (i<1 || i>=m) {
cout<<endl<<"**** 超出范圍!****"<<endl<<"請重新輸入:";
}
else
{cout<<endl<<"你要訂的是到"<<i<<"地的飛機"<<endl;
cout<<endl<<"第 "<<i<<" 架飛機剩餘的票 :"<<endl;
for(p=1;p<=n;p++)
if (a[i].seat[p]==0) cout<<" "<<p;
cout<<endl;
break;}
}while(1);
cout<<endl<<"請選擇座位號 : ";
do {
cin>>j;
if (j<1 || j>n) {
cout<<endl<<"**** 超出范圍!****"<<endl<<"請重新輸入:";
}
else
{
q->date=i;
cout<<endl<<"您的訂票日期 : "<<q->date<<endl;
break;
}
}while(1);

if (a[i].seat[j]==0) {
a[i].seat[j]=1;
cout<<endl;
a[i].seat[0]++;
if(i==1) add_information(head1,1,j);
if(i==2) add_information(head2,2,j);
if(i==3) add_information(head3,3,j);
}
else
{
cout<<endl<<"**** 對不起,該座位已被預訂,您被安排到訂票等候隊列 ****"<<endl;
add_wait(i,j);
}

}
void add_wait(int x,int y)
{
wait *tempw;
tempw=new wait;
tempw->next=NULL;
cout<<"請輸入個人信息"<<endl;
cout<<endl<<"*************"<<endl;
cout<<"姓名 : ";cin>>tempw->name;
cout<<"ID號 : ";cin>>tempw->id;
cout<<"電話 :";cin>>tempw->phone;
tempw->seat=y;
tempw->plane=x;
wait_end->next=tempw;
tempw->pre=wait_end;
wait_end=wait_end->next;
cout<<endl<<"**** 正在排隊等候 ****"<<endl;
wait_head->count++;
write_to_file();
}
void show_wait()
{
wait *tempw;
tempw=wait_head->next;
if (tempw==NULL) cout<<endl<<"排隊中沒有人!"<<endl;
while(tempw!=NULL)
{
cout<<tempw->name<<" - ";
tempw=tempw->next;
}
}
void add_information(node *head,int x,int y)
{
node *temp;
temp=new node;
temp->pre=NULL;
temp->next=NULL;
cout<<"請輸入個人信息"<<endl;
cout<<endl<<"*************"<<endl;
cout<<"姓名 : ";cin>>temp->name;
cout<<"ID號 : ";cin>>temp->id;
temp->seat=y;
temp->plane=x;
temp->next=head->next;
temp->pre=head;
if (head->next!=NULL) head->next->pre=temp;
head->next=temp;
write_to_file();
cout<<endl<<"**** 訂票成功 ****"<<endl;
}
void search_delete(int x)
{
node *p,*q,*r;
wait *tempw,*tempw2,*tempw3;
int step=1,t1,t2,i;
char ch;
p=new node;
tempw=new wait;
tempw2=new wait;
tempw3=new wait;
q=head1;
cout<<endl<<"請輸入個人信息"<<endl;
cout<<"*************"<<endl;
cout<<endl<<"姓名 : ";cin>>p->name;
do{
q=q->next;
if ( (q!=NULL) &&
(comp(q,p)) )
{
cout<<endl;
q->date=q->plane;
cout<<"Located!"<<endl;
cout<<"****************";
cout<<endl<<"姓名 : "<<q->name;
cout<<endl<<"ID號 : "<<q->id;
cout<<endl<<"座位號 : "<<q->seat;
cout<<endl<<"班機號 : "<<q->plane;
cout<<endl<<"日期 : "<<q->date<<endl;
if (x==1) {
cout<<"刪除該紀錄 ? [Y/N] ";
cin>>ch;
if (ch=='Y' || ch=='y') {
t1=q->plane;
t2=q->seat;
a[t1].seat[t2]=0;
a[t1].seat[0]--;
r=q;q=q->pre;
r->pre->next=r->next;
if(r->next!=NULL) r->next->pre=r->pre;
delete(r);
cout<<"**** 記錄刪除成功 ! ****";
write_to_file();
tempw=wait_head;
for(i=0;i<wait_head->count;i++)
{
tempw=tempw->next;
if(tempw==NULL) break;
if((tempw->plane==t1) && (tempw->seat==t2))
{
strcpy(tempw3->name,tempw->name);
strcpy(tempw3->phone,tempw->phone);
cout<<endl<<"等候的人中有可以訂票的了:"<<endl;
cout<<endl<<"姓名 : "<<tempw->name;
cout<<endl<<"ID號 : "<<tempw->id<<endl;
a[t1].seat[0]++;
a[t1].seat[t2]=1;
if(tempw->plane==1) add_information(head1,1,tempw->seat);
if(tempw->plane==2) add_information(head2,2,tempw->seat);
if(tempw->plane==3) add_information(head3,3,tempw->seat);
tempw2=tempw->pre;
tempw2->next=tempw->next;
if(tempw->next==NULL) wait_end=tempw2;
else tempw->next->pre=tempw2;
delete(tempw);
wait_head->count--;
write_to_file();
cout<<endl<<"等候的"<<tempw3->name<<"已經成功訂票,已經由電話"<<tempw3->phone<<"通知了"<<endl;
break;
}
}

}
}continue;
}
else
{
if (q==NULL)
{
step++;
if(step==2) q=head2;
if(step==3) q=head3;
if(step==4) {cout<<endl<<"**** 信息檢索完畢 ****";break;}
}
}
}while(1);
}
bool comp(node *x,node *y)
{
node *p,*q;
int i,j,k;
p=x;
q=y;
i=j=0;
do
{
while ( (p->name[i] != q->name[j]) && (p->name[i] != '\0') ) i++;

if (p->name[i] == '\0') {return(false);break;}
else
{
k=i;
while ( (p->name[k] == q->name[j]) && (q->name[j]!='\0') ) {k++;j++;}
if (q->name[j]=='\0') return(true);
else
{
j=0;
i++;
}
}
}while( (q->name[j]!='\0') && (p->name[i] != '\0') );
return(false);
}

void write_to_file()
{
FILE *fp;
int i,j;
int x[m];
node *p;
wait *tempw;
tempw=new wait;
tempw=wait_head;
fp=fopen("piao.dat","w");
for (i=1;i<=m-1;i++)
{
fwrite(&a[i],sizeof(piao),1,fp);
}
fclose(fp);

fp=fopen("information.dat","w");
x[0]=0;x[1]=a[1].seat[0];
for(i=0,j=1;j<=m-1;j++) {i=i+a[j].seat[0];x[j]=a[j].seat[0]+x[j-1];}
j=1;p=head1->next;
for(j=1;j<=i;j++)
{
if(j==x[1]+1) p=head2->next;
if(j==x[2]+1) p=head3->next;
if(p==NULL)break;
fwrite(p,sizeof(node),1,fp);
p=p->next;
}
fclose(fp);

fp=fopen("wait.txt","w");
for(j=0;j<=wait_head->count;j++)
{
if(tempw==NULL)break;
fwrite(tempw,sizeof(wait),1,fp);
tempw=tempw->next;
}
fclose(fp);
}

❻ C語言編寫一個簡單的航空管理系統

需要分析:
A.車尋航線:
1.根據旅客提出的起點站,終點站名輸出下列信息:航班號,票價,折扣,最多載客量,是否滿載,起飛時間,降落時間和飛行時間;
2.根據訂票乘客的姓名可以查詢所訂航班的航班號,座位號,飛行日期等信息;
3.根據航班號查詢航班的起點站,中轉站,終點站名,票價,折扣,最多載客量,是否滿載,起飛時間,降落時間和飛行時間;
B.承辦客戶提出的要求(航班號、訂票數額)查詢該航班票額情況,若有餘票,則為客戶辦理訂票手續,輸出座位號,需付款項信息;若已滿員或余票額少於盯票額,則需重新詢問客戶要求。若需要,可登記排隊候補;
C.根據客戶提供的情況(日期、航班),為客戶辦理退票手續。(然後查詢該航班是否有人排隊候補,首先詢問排第一的客戶,若所退票額所能滿足他的要求,則為他辦理訂票手續,否則依次詢問其他排隊候補客戶);
E.內部人員對航班情況的控制:
可以錄入航班信息,刪除航班信息,修改航班信息,查看基本航班信息。

概要設計:
因為每個客戶名單或查詢名單都包括多個數據域,這樣就需要有一個能存儲多個數據域的數據類型來存儲,因此採用單鏈表類型。由於航線的信息是固定的,可選用結構體數組,又因為訂票與預約人數無法預計,可選用鏈表存儲信息。
線性表的單鏈表存儲結構:typedef struct LNode{
ElemType;
Struct Lnode*next;}LNode,*LinkList;
a.抽象數據類型順序表的定義如下:
ADT SqList{
數據對象:D={ai|ai∈數據類型,i=1,2,3...,n}
數據關系:R1={<ai-1,ai>|ai-1,ai∈D,i=1,2,3...,n}
基本操作:
InitList_Sq(&L)
操作結果:創建空的順序表。
CreatList_Sq(&L)
操作結果:建立順序表。
}ADT SqList

b.抽象數據類型單鏈表的定義如下:
ADT LinkList{
數據對象:D={ai|ai∈結構類型,i=1,2,3...,n,n>0}
數據關系:R1={<ai-1,ai>|ai-1,ai∈D,i=1,2,3...,n}
基本操作:
InitList_L(&L)
操作結果:創建空的順序表。
}ADT LinkList
在main()里調用各個函數
2.主程序
void main(){
初始化;
do{
接受命令
處理命令;
}while(「命令」!=「退出」);
}
3.程序的模塊調用:

三.詳細設計:
1.所有數據類型:
struct plan /*航班數據*/
{
char num[5];/*航班號碼*/
char city[10];/*到達城市*/
char up[8];/*航班起飛時間*/
char down[8];/*航班到達時間*/
int pric ;/*航班價格*/
int rshu ;/*人數*/
int zheg[4];/*價格折扣*/
}
;
struct man/*定票人數據*/
{
char num[10];/*身份證號碼*/
char nam[10];/*姓名*/
int demand ;/*定票數量*/
}
;
typedef struct node/*航班數據結點*/
{
struct plan data ;
struct node*next ;
}
Node,*Link ;
typedef struct people/*乘客數據結點*/
{
struct man data ;
struct people*next ;
}
peo,*LIN ;

2.程序所用函數:
void print()/*界面輸出*/
{
printf("============================System of book ticket===============================\n");
printf("\n");
printf("\t***********************************************************\n");
printf("\t*\t1---Bookticket \t2---Dishonorbill *\n");
printf("\t*\t3---Adding flight\t4---Adding flight *\n");
printf("\t*\t5---Modify \t6---Advice *\n");
printf("\t*\t7---Save \t8---exit *\n");
printf("\t##########################################################\n");
}
添加航班模塊
void add(Link l)/*添加航班數據*/
{
Node*p,*r,*s ;
char num[10];
r=l ;
s=l->next ;
while(r->next!=NULL)
r=r->next ;
while(1)
{
printf("please input the number of the plan(0-return)");/*輸入0就返回*/
scanf("%s",num);
if(strcmp(num,"0")==0)
break ;
while(s)
{
if(strcmp(s->data.num,num)==0)
{
printf("=====tip:the number'%s'has been born!\n",num);

return ;
}
s=s->next ;
}
p=(Node*)malloc(sizeof(Node));/*航班數據輸入*/
strcpy(p->data.num,num);
printf("Input the city where the plan will reach:");/*飛機到達地城市*/
scanf("%s",p->data.city);
getchar();
printf("Input the time which the plan take off:");/*起飛時間*/
scanf("%s",p->data.up);
getchar();
printf("Input the time which the plan reach:");/*降落時間*/
scanf("%s",&p->data.down);
getchar();
printf("Input the price of ticket:$");/*機票價格*/
scanf("%d",&p->data.pric);
getchar();
printf("Input the number of people who have booked ticket:");/*定票數量*/
scanf("%d",&p->data.rshu);
getchar();
printf("Input the agio of the ticket:");
scanf("%s",&p->data.zheg);
getchar();
p->next=NULL ;
r->next=p ;
r=p ;
shoudsave=1 ;
}
}
輸出模塊
void pri(Node*p)/*輸出函數*/
{
printf("\n\t\t\tThe following is the record you want:\n");
printf("\nnumber of plan: %s",p->data.num);
printf("\ncity the plan will reach: %s",p->data.city);
printf("\nthe time the plan take off: %s\nthe time the plan reach: %s",p->data.up,p->data.down);
printf("\nthe price of the ticket: %d",p->data.pric);
printf("\nthe number of people who have booked ticket: %d",p->data.rshu);
printf("\nthe agio of the ticket:%s",p->data.zheg);

}
退出函數模塊
Node*Locate1(Link l,char findmess[],char numorcity[])
{
Node*r ;
if(strcmp(numorcity,"num")==0)
{
r=l->next ;
while(r)
{
if(strcmp(r->data.num,findmess)==0)
return r ;
r=r->next ;
}
}
else if(strcmp(numorcity,"city")==0)
{
r=l->next ;
while(r)
{
if(strcmp(r->data.city,findmess)==0)
return r ;
r=r->next ;
}
}
return 0 ;
}

航班信息模塊
void qur(Link l)/*航班信息查詢*/

{
Node*p ;
int sel ;
char str1[5],str2[10];

if(!l->next)
{
printf("TIP:there are not any record to be inquired for you!");
return ;
}
printf("Choose the way:(1->according to the number of plan;2->according to the city):");/*選擇航班號查詢和終點城市查詢*/
scanf("%d",&sel);
if(sel==1)
{
printf("Input the the number of plan:");
scanf("%s",str1);
p=Locate1(l,str1,"num");
if(p)
{
printf("the following is what you want:\n");
pri(p);
}
else
{
mark1=1 ;
printf("\nthe file can't be found!");
}
}
else if(sel==2)
{
printf("Input the city:");
scanf("%s",str2);
p=Locate1(l,str2,"city");
if(p)
{
printf("the following is what you want:\n");
pri(p);
}
else
{
mark1=1 ;
printf("\nthe file can't be found!");
}
}
}

定票模塊
void buy(Link l,LIN k)/*定票函數*/
{
Node*r[10],*p ;
int ch,dem ;
peo*v,*h ;
int i=0,t=0 ;
char str[10],str1[10],str2[10];
v=k ;
while(v->next!=NULL)
v=v->next ;
printf("Input the city you want to go: ");/*航班終點站城市*/
scanf("%s",&str);
p=l->next ;
while(p!=NULL)
{
if(strcmp(p->data.city,str)==0)
{
r[i]=p ;
i++;
}
p=p->next ;
}
printf("\n\nthe number of record have %d\n",i);
for(t=0;t<i;t++)
pri(r[t]);
if(i==0)
printf("\n\tSorry!Can't find the plan for you!\n");
else
{
printf("\ndo you want to book it?<1/0>\n");
printf("please choose: ");
scanf("%d",&ch);
if(ch==1)
{
h=(peo*)malloc(sizeof(peo));/*重新分配空間*/
printf("Input your name: ");
scanf("%s",&str1);
strcpy(h->data.nam,str1);
printf("Input your id: ");
scanf("%s",&str2);
strcpy(h->data.num,str2);
printf("Input your demand: ");
scanf("%d",&dem);
h->data.demand=dem ;
h->next=NULL ;
v->next=h ;
v=h ;
printf("\n\tLucky!Success in booking ticket!");
getch();
shoudsave=1 ;
}
}
}
peo*Locate2(LIN k,char findmess[])
{
peo*r ;
r=k->next ;
while(r)
{
if(strcmp(r->data.num,findmess)==0)
{
mark=1 ;
return r ;
}
r=r->next ;
}
return 0 ;
}
退票模塊
void tui(LIN k)/*退票函數*/
{
char str[10];
peo*p,*r ;
int ch2=0 ;
printf("Input your id: ");/*輸入身份證號*/
scanf("%s",&str);
p=Locate2(k,str);
if(mark!=1)
printf("can't find the people!");
else if(mark==1)
{
mark=0 ;
printf("\t\t\tthe following is the record you want:\n");
printf("your id:%s\n",p->data.num);
printf("name:%s\n",p->data.nam);
printf("your denmand:%d",p->data.demand);
printf("\ndo you want to refund the ticket?<1/0>");
scanf("%d",&ch2);
if(ch2==1)
{
if(p)
{
r=k ;
while(r->next!=p)
r=r->next ;
r->next=p->next ;
free(p);
}
count2--;
printf("\nyou have sucessed in refunding ticket!");
shoudsave=1 ;
}
}
}

void Modify(Link l)/*修改航班信息*/
{
Node*p ;
char findmess[20],ch ;
if(!l->next)
{
printf("\n=====tip:there isn't record for you to modify!\n");
return ;
}
else
{
qur(l);
if(mark1==0)
{
printf("\nDo you want to modify it?\n");
getchar();
scanf("%c",&ch);
if(ch=='y');
{
printf("\nInput the number of the plan:");
scanf("%s",findmess);
p=Locate1(l,findmess,"num");
if(p)
{
printf("Input another number of plan:");
scanf("%s",&p->data.num);
getchar();
printf("Input another city the plan will reach:");
scanf("%s",&p->data.city);
getchar();
printf("Input another time the plan take off");
scanf("%s",&p->data.up);
printf("Input another time the plan reach:");
scanf("%s",&p->data.down);
printf("Input another price of the ticket::");
scanf("%d",&p->data.pric);
printf("Input another number of people who have booked ticket:");
scanf("%d",&p->data.rshu);
printf("Input another agio of the ticket:");
scanf("%s",&p->data.zheg);
printf("\n=====>tip:modifying record is sucessful!\n");
shoudsave=1 ;
}
else
printf("\tcan't find the flight!");
}
}
else
mark1=0 ;
}
}

void advice(Link l)/*終點站航班查詢*/
{
Node*r ;
char str[10];
int mar=0 ;
r=l->next ;
printf("Iuput the city you want to go: ");/*輸入終點站城市*/
scanf("%s",str);
while(r)
{
if(strcmp(r->data.city,str)==0&&r->data.rshu<200)
{
mar=1 ;
printf("\nyou can select the following plan!\n");
printf("\n\nplease select the fourth operation to book the ticket!\n");
pri(r);
}
r=r->next ;
}
if(mar==0)
printf("\n\t\t\tyou can't book any ticket now!\n");

}

void save1(Link l)/*保存數據*/
{
FILE*fp ;
Node*p ;
int count=0,flag=1 ;
fp=fopen("g:\\data1","wb");
if(fp==NULL)
{
printf("the file can't be opened!");
return ;
}
p=l->next ;
while(p)
{
if(fwrite(p,sizeof(Node),1,fp)==1)
{
p=p->next ;
count++;
}
else
{
flag=0 ;
break ;
}
}
if(flag)
{
printf("the number of the record which have been saved is %d\n",count);
shoudsave=0 ;
}
fclose(fp);
}

void save2(LIN k) /*保存數據*/
{
FILE*fp ;
peo*p ;
int count=0,flag=1 ;
fp=fopen("g:\\data2","wb");/*文件連接*/
if(fp==NULL)
{
printf("the file can't be opened!");
return ;
}
p=k->next ;
while(p)
{
if(fwrite(p,sizeof(peo),1,fp)==1)
{
p=p->next ;
count++;
}
else
{
flag=0 ;
break ;
}
}
if(flag)
{
printf("the number of the record which have been saved is %d\n",count);
shoudsave=0 ;
}
fclose(fp);
}

四.主函數模塊:

main()
{
FILE*fp1,*fp2 ;
Node*p,*r ;
char ch1,ch2 ;
Link l ;
LIN k ;
peo*t,*h ;
int sel ;
l=(Node*)malloc(sizeof(Node));
l->next=NULL ;
r=l ;
k=(peo*)malloc(sizeof(peo));
k->next=NULL ;
h=k ;
fp1=fopen("g:\\data1","ab+");
if((fp1==NULL))
{
printf("can't open the file!");
return 0 ;
}

while(!feof(fp1))
{
p=(Node*)malloc(sizeof(Node));

if(fread(p,sizeof(Node),1,fp1)==1)
{
p->next=NULL ;
r->next=p ;
r=p ;

count1++;
}
}
fclose(fp1);
fp2=fopen("g:\\data2","ab+");
if((fp2==NULL))
{
printf("can't open the file!");
return 0 ;
}

while(!feof(fp2))
{
t=(peo*)malloc(sizeof(peo));

if(fread(t,sizeof(peo),1,fp2)==1)
{
t->next=NULL ;
h->next=t ;
h=t ;

count2++;
}
}
fclose(fp2);
while(1)
{

getch();
clrscr();

print();
printf("please choose the operation(1-8): ");
scanf("%d",&sel);
if(sel==8)
{
if(shoudsave==1)
{
getchar();
printf("\n=====tip:the file have been changed!do you want to save it(y/n)?\n");
scanf("%c",&ch1);
if(ch1=='y'||ch1=='Y')
{
save2(k);
save1(l);
}
}
printf("\n\tyou have exited! Happy serve for you");
break ;

}
switch(sel)
{
case 1 :
buy(l,k);
break ;

case 2 :
tui(k);
break ;

case 3 :
qur(l);
break ;

case 4 :
add(l);
break ;

case 5 :
Modify(l);
break ;

case 6 :
advice(l);
break ;

case 7 :
{
save1(l);
save2(k);
break ;
}

case 8 :
exit(0);
}

}
getch();
}

❼ 求飛機訂票系統課程設計源代碼要c++的!

規模不小
相當水平的c++才可以完成。。。沒有想像中的哪么難,但也不容易實現。不過我可以做。

❽ 航空售票系統 C語言

這個貌似可以用多線程

❾ 關於.net的,求一個完整的飛機訂票系統源代碼,有資料庫的

搜下吧這個東西

❿ 飛機訂票系統的源代碼

機票預定系統概要設計說明書1.引言
1.1 編寫目的
在本機票預定系統項目的前一階段,也就是需求分析階段中,已經將系統用戶對本系統的需求做了詳細的闡述,這些用戶需求已經在上一階段中對航空公司、各旅行社及機場的實地調研中獲得,並在需求規格說明書中得到詳盡得敘述及闡明。
本階段已在系統的需求分析的基礎上,對機票預定系統做概要設計。主要解決了實現該系統需求的程序模塊設計問題。包括如何把該系統劃分成若干個模塊、決定各個模塊之間的介面、模塊之間傳遞的信息,以及數據結構、模塊結構的設計等。在以下的概要設計報告中將對在本階段中對系統所做的所有概要設計進行詳細的說明。
在下一階段的詳細設計中,程序設計員可參考此概要設計報告,在概要設計對機票預定系統所做的模塊結構設計的基礎上,對系統進行詳細設計。在以後的軟體測試以及軟體維護階段也可參考此說明書,以便於了解在概要設計過程中所完成的各模塊設計結構,或在修改時找出在本階段設計的不足或錯誤。 1.2 項目背景 本項目(機票預定系統)時由浙江航空公司委託,由<>負責開發。
機票預定系統將由兩部分組成:置於個旅行社定票點的前台客戶程序,以及置於航空公司的資料庫伺服器。本系統與其他系統的關系如下: 1.3 定義 1.3.1 專門術語
SQL SERVER: 系統伺服器所使用的資料庫管理系統(DBMS)。
SQL: 一種用於訪問查詢資料庫的語言
事務流:數據進入模塊後可能有多種路徑進行處理。
主鍵:資料庫表中的關鍵域。值互不相同。
外部主鍵:資料庫表中與其他表主鍵關聯的域。
ROLLBACK: 資料庫的錯誤恢復機制。
1
1.3.2 縮寫
系統:若未特別指出,統指本機票預定系統。
SQL: Structured Query Language(結構化查詢語言)。
ATM: Asynchronous Transfer Mode (非同步傳輸模式)。
1.4 參考資料 以下列出在概要設計過程中所使用到的有關資料:
1. 機票預定系統項目計劃任務書 浙江航空公司 1999/3 2.機票預定系統項目開發計劃 《》軟體開發小組 1999/3
3.需求規格說明書 《》軟體開發小組 1999/3
4.用戶操作手冊(初稿) 《》軟體開發小組 1999/4
5.軟體工程及其應用 周蘇、王文等 天津科學技術出版社 1992/1
6.軟體工程 張海藩 清華大學出版社 1990/11
7.Computer Network A.S.Tanenbaun Prentice Hall 1996/01
文檔所採用的標準是參照《軟體工程導論》沈美明著 的「計算機軟體開發文檔編寫指南」。
2.任務概述

閱讀全文

與航空系統開發源碼相關的資料

熱點內容
噴油螺桿製冷壓縮機 瀏覽:579
python員工信息登記表 瀏覽:377
高中美術pdf 瀏覽:161
java實現排列 瀏覽:513
javavector的用法 瀏覽:982
osi實現加密的三層 瀏覽:233
大眾寶來原廠中控如何安裝app 瀏覽:916
linux內核根文件系統 瀏覽:243
3d的命令面板不見了 瀏覽:526
武漢理工大學伺服器ip地址 瀏覽:149
亞馬遜雲伺服器登錄 瀏覽:525
安卓手機如何進行文件處理 瀏覽:71
mysql執行系統命令 瀏覽:930
php支持curlhttps 瀏覽:143
新預演算法責任 瀏覽:444
伺服器如何處理5萬人同時在線 瀏覽:251
哈夫曼編碼數據壓縮 瀏覽:426
鎖定伺服器是什麼意思 瀏覽:385
場景檢測演算法 瀏覽:617
解壓手機軟體觸屏 瀏覽:350