C语言编写一个简单的航空管理系统

作者&投稿:夏蓝 (若有异议请与网页底部的电邮联系)
用C语言编写一个 航空管理系统~

200分,到我这里来拿代码。
先给个图看下。

#include
#include
#include
#include
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<<"
************ 欢迎来到民航售票系统,请选择您需要的操作并输入相应数字! ***********
";
cout<<"(1)录入信息
";
cout<<"(2)按起点查出所有航班的信息
";
cout<<"(3)按终点查出所有航班的信息
";
cout<<"(4)按日期、航班号查询航班信息
";
cout<<"(5)按起点站统计航班数
";
cout<<"(6)退出
";
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<<"请依次输入航班号、日期、起点站、终点站、起飞时间、到达时间、票价
";
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.
";
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.
";
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<<"
系统中没有航班信息,请先进行录入操作!"<<endl; break; }
do
{
flag=0;count=0;
cout<<"
请输入要统计的航班起点站:"<<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<<"
您要查询的起点站为"<<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);
}
}

需要分析:
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语言编写一个简单的程序!
1、鼠标左键双击c语言软件,打开,打开后界面如图,点击关闭即可 2、点击上方程序窗口左上角的文件,选择新建 3、在打开的窗口中选择文件,下边一般是第四个 c++Source file,输入文件名(hellw.c),一定要以“.c”为后缀结尾 4、进入编辑页面在,页面编辑源代码就可以 includestdio.h void main()...

C语言编写一个程序,求x> y的运行结果
以下是一个简单的C语言程序,可以比较两个整数x和y,并打印出相应的结果:在这个程序中,我们首先声明了两个整数变量x和y,然后使用printf函数提示用户输入两个整数。接下来,我们使用scanf函数读取用户输入的整数,并将它们存储在变量x和y中。然后,我们使用一个if-else语句来比较x和y的值。如果x大于y...

c语言如何实现一个简单的计算器?
1.C语言是一个有结构化程序设计、具有变量作用域(variable scope)以及递归功能的过程式语言。2.C语言传递参数均是以值传递(pass by value),另外也可以传递指针(a pointer passed by value)。3.不同的变量类型可以用结构体(struct)组合在一起。4.只有32个保留字(reserved keywords),使变量...

C语言怎么编写一个数组?
在 C 语言中,编写一个数组需要声明数组的大小和类型,然后为数组分配内存。以下是一个简单的示例,展示了如何声明和初始化一个整数数组:```c include <stdio.h> int main() { \/\/ 声明一个包含 10 个元素的整数数组 int arr[10];\/\/ 初始化数组的第一个元素为 10 arr[0] = 10;\/\/ 初始...

怎样用C语言编写一个简单的程序?
下面是一个简单的例子,它展示了如何手动输入 7 个元素,然后求这 7 个元素的和,并输出最大值和最小值。include <stdio.h> int main(){ int a[7]; \/\/ 建立一个 7 元素的数组 int i;int sum = 0;int max = a[0];int min = a[0];\/\/ 手动输入 7 个元素 for (i = 0; i ...

如何用C语言编写一个1~99999数字的数列?
在C语言中,可以使用循环和条件语句来编写一个1~99999数字的数列。以下是一个简单的示例代码:在这个示例代码中,for循环用于遍历1到99999之间的所有数字,printf函数用于输出数字。%d是格式控制字符串,用于指定输出的整数类型。\\n是换行符,用于在输出数字后换行。运行这个程序,将会输出一个1~99999数字...

怎样用C语言编一个两数相加的程序?
您可以使用C语言中的加法运算符(+)来编写一个两数相加的程序。以下是一个简单的示例程序:在上面的程序中,我们首先定义了三个变量:num1、num2和sum。num1和num2用于存储用户输入的两个数字,而sum用于存储这两个数字的和。接下来,我们使用printf函数提示用户输入两个数字,并使用scanf函数将用户...

用C语言怎样编写一句话
方法\/步骤 1、首先,打开编译器,新建文件。出现的空白处是写代码的。2、输入”#include<stdio.h>“这个为头文件。3、第二行,输入”main“,加上一对”小括号“。4、在main,下方,输入一对大括号 {}。5、在大括号里输入,”printf("Hello,Word\\n");”。6、运行程序即可看到输入的话了。

c语言编写一个程序,非常简单
(1)include "stdio.h"#include "math.h"int main(int argc,char *argv[]){float m,r;int n;printf("Please input, the number of the principal and interest rates in turn.\\n");if(scanf("%f,%d,%f",&m,&n,&r)!=3 || m<0 || n<0 || r<0){printf("Input error, exit...

乌达区17542545857: C语言编程民航管理系统 -
祖飞妥布: #include "stdio.h" #include "conio.h" #define N 3 typedef struct hb{ int hbh; char qsd[100],zdz[100]; char days[10]; int member; } P; P t[N]; main() {FILE *wj; int i,at,s=0; char a,t[100]; if(wj=fopen("ss.txt","at+")==NULL) {printf("文件没有打...

乌达区17542545857: 用C语言编写一个航班订票管理系统,该系统用于机场航班订票.假设某机场有若干次,每次有N个座位的飞机航 -
祖飞妥布: #include<stdio.h> #include<string.h> #include<stdlib.h> #define OK 1 #define TRUE 1 #define FALSE 0 #define ERROR 0 #define OVERFLOW -2 #define PR printf typedef int status; typedef struct airline{ char line_num[8];//航班号 char plane_...

乌达区17542545857: 求一个客机航线信息管理系统的C语言程序,课设急用
祖飞妥布: /* Note:Your choice is C IDE */ #include "stdio.h" void main() { int a,b,m,n,i; // 定义变量 printf("input two numbers:\n"); scanf("%d%d",&amp;a,&amp;b); m=a&gt;b?a:b; // 规定m为较大者 n=a&lt;b?a:b; // 规定n为较小者 i=m%n; while(i) { m=n; n=i; i=m%n; // 辗转相除 } printf("the result is %d",n); } 已成功运行,希望对你有帮助

乌达区17542545857: 0基础学c语言学了十多天了,老师说要我们自己单独做一个航空管理系统,可是我不知道怎么下手,怀疑人生 -
祖飞妥布: 你们的老师是二百五吧?0基础学十多天C就能“单独做出航空管理系统”来,他不是把你看成了神,就是把C看得太小儿科了,抑或他自己的脑子进水了……

乌达区17542545857: 跪求一个程序,用C语言编一个,航空售票系统
祖飞妥布:http://download.enet.com.cn/speed/toftp.php?fname=033412005020605《航空售票客户管理系统》,能用于所有航空售票处(公司、中心,点)的客户资料和送票情况管理,能对客户累计购票情况进行统计分析,具自动编号、快速查询、客户购票统计、送票员管理、密码设置等功能,能根据任意电话号码快速定位到某一客户,并录入购票明细情况,其所属业务员功能可考核业务员的业绩情况.能制作各种客户资料报表,表格制作具有较强的可扩充性.业经某大航空售票中心使用后,效果良好.通过使用该软件,有利于提高工作效率,加强与客户之间的沟通和了解,增强客户的信任感,从而达到提高机票销售量的目的.

乌达区17542545857: 用c语言编写一个飞机定票系统
祖飞妥布: #include<string.h> #include<conio.h> #include<stdio.h> #define M 5 /*飞机数*/ #define N 12 /*每架飞机座位数*/ struct peo {int number[M]; /*航班号*/ char time[M][20]; /*出发时间*/ char adr[M][20]; /*目的地*/ int zuoci; char dingfou[M]; char name...

乌达区17542545857: 用C语言或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; ...

乌达区17542545857: 谁有关于航空公司订票管理系统的c语言代码啊 -
祖飞妥布: 1-4我不知道你所说的意思.其实c语言要想提高就得靠你多练,如果看了别人的在去做就没意思啦.只有让自己处于高压状态才能想到方法.多去自己想想吧.下边是我刚做的一个二维订票系统!你可以参考着看看. #include<stdio.h>#include<...

乌达区17542545857: C++ 航空管理系统 用数据链表编写的程序代码 急 谢啦 -
祖飞妥布: 写了一个 #include "list.h" #include "list.cpp" #include#include#include#include#include#include#includeusing namespace std; void PlaneInformation(string a, string b, string c, int d, int e, double h, double i) { cout &s, List &n) { cout

乌达区17542545857: 航班信息管理 【必需用C语言编程】非常急需!关系到能否毕业的!要有解释!悬赏100.
祖飞妥布: 做一个系统是需要付费的,几千元几万元不等,你看看在校大学生,他们收费应该很低的,毕竟是以学业为主嘛,暂时没有经商头脑 我一段一段发给你,你试试,我运行不过有点错误,你试试改动一下吧 ,大体轮廓给你,相信你应该就差不多...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网