?? query.c
字號:
#include "QUERY.H"
int Query_Allf(flight pflight[])
{
int i;
int tag = 0;
for (i = 0; i < 40; i++)
{
if (pflight[i].f_flight_num != -1)
{
tag = 1;
}
}
if (i==40&&tag==0)
{
printf("航班不存在!\n");
}
return tag;
}
void Query_Flnum(flight pflight[], pa_node pa)
{
int i, num;
pa_node pb;
char tag = 'n';
if (Query_Allf(pflight) == 0)
return ;
printf("輸入航班號:\n");
scanf("%ld", &num);
for (i = 0; i<40; i++)
{
if (pflight[i].f_flight_num == num)
{
for (pb=pa->next; pb!=NULL; pb=pb->next)
{
if (pb->_pnode.p_flight_num==num)
{
tag = 'y';
printf("乘坐該航班的乘客有:\n");
printf("姓名\t\t住址\t\t訂票數量");
printf("\t\t票價\t\t航班編號\n");
printf("%s", pb->_pnode.p_name);
printf("\t\t%s", pb->_pnode.p_address);
printf("\t\t%d", pb->_pnode.p_ticket_cou);
printf("\t\t%.2f\t\t%ld\n\n", pflight[i].f_ticket_pri,
pb->_pnode.p_flight_num);
}
}
break;
}
}
if (tag == 'n')
{
printf("無人乘坐本次航班!\n");
}
return ;
}
void Query_Fromto(flight pflight[], pa_node pa)
{
char from[20], to[20];
int i, tag = 0;
pa_node pb;
printf("輸入始點、終點:\n");
scanf("%s", from);
scanf("%s", to);
if (Query_Allf(pflight) == 0)return ;
for (i = 0; i < 40; i++)
{
if (strcmp(pflight[i].f_from, from) && strcmp(pflight[i].f_to,to))
{
for (pb=pa->next; pb!=NULL; pb=pb->next)
{
if(pb->_pnode.p_flight_num==pflight[i].f_flight_num)
{
tag = 1;
printf("從--%s", from);
printf("經--%s", pflight[i].f_pass);
printf("到--%s的乘客有:\n", to);
printf("%s\n", pb->_pnode.p_name);
}
}
}
}
if (tag == 0)
{
printf("無人乘坐本次航班!\n");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -