資源簡介
visual C++上寫的銀行排隊系統(tǒng)。數(shù)據(jù)結(jié)構(gòu)的大作業(yè)。包含源程序,系統(tǒng)導航和實驗報告。

代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
#define?n?3
int?vip1=0;
int?yz;
float?sum1=0sum2=0sum3=0sum4=0sum5=0;
float?i1=0i2=0i3=0i4=0i5=0;
float?ave1=0ave2=0ave3=0ave4=0ave5=0;
static?int?N;
struct?List{
??int?A[n+1];???????????//顧客用來辦理業(yè)務的N個窗口
??int?len;??????????????//表示數(shù)組中的元素個數(shù)
}L;
struct?Lnode{????????????//鏈表結(jié)點類型
??int?data;
??Lnode?*next;
};
struct?linkqueue{???????//鏈式存儲的等候隊列的類型定義
??Lnode?*front;
??Lnode?*rear;
}Q;
void?Initshuzu()????????//初始化線性的算法
{
??for(int?i=1;i<=n;i++)
??L.A[i]=0;?????????????//元素值為0,表示編號為I的窗口當前狀態(tài)為空
??L.len=0;
}
?void?Initqueue()???????//初始化隊列的算法
{
??Q.front=Q.rear=(Lnode?*)malloc(sizeof(Lnode));
??Q.front->next=NULL;
}
void?Enqueue(linkqueue?*Qint?elem)??//進隊算法
{
???Lnode?*s;
???s=(Lnode?*)malloc(sizeof(Lnode));
???s->data=elem;
???s->next=NULL;
???Q->rear->next=s;
???Q->rear=s;
}
int?Dlqueue(linkqueue?*Q)??//出隊算法
{
???Lnode?*t;
???int?x;
???if(Q->front==Q->rear)
???{
???printf(“隊列為空!\n“);
???exit(1);
???}
else
{
??t=Q->front->next;
??Q->front->next=t->next;
??x=t->data;
??free(t);
??return?x;
}
}
void?printl()????//輸出數(shù)組算法
{?
int?i;
????printf(“正在辦理業(yè)務的顧客編號為:??一號柜臺???????二號柜臺???????三號柜臺\n“);
printf(“?????????????????????????????“);
????for(?i=1;i<=L.len;i++)
{
printf(“%d號客戶????????“L.A[i]);
??????
}
printf(“\n“);?
}
void?print2()???????//輸出隊列算法
{
int?i=0;
????printf(“正在等候辦理業(yè)務的顧客編號為:“);
????Lnode?*s=Q.front->next;
???while(s!=NULL)
???{
?????printf(“%d?“s->data);
?????s=s->next;
?i++;
???}
???printf(“\n您的前面一共有%d人在排隊,請您稍候!“i);
printf(“\n“);
}
void?daoda(int?x)???//解決顧客到達事件算法
{???
int?i=L.len+1;
if?(L.len { L.A[i]=x;
i++;
L.len++;
???}
???
else
??Enqueue(&Qx);
}
void?likai(int?x)????????//解決顧客離開事件算法
{??
int?i=0;
do
{
if(x>L.len)
{
printf(“輸入有誤!\n請重新輸入:“);
scanf(“%d“&x);
}
else
???for(i=0;i<=L.len;i++)
???{
if(i==x)
{
?printf(“尊敬的%d號顧客您好!\n“x);
?L.A[i]=0;
?L.len--;
?if(Q.front!=Q.rear)
?{
int?y=Dlqueue(&Q);
L.A[i]=y;
?L.len++;
?}
}
???}
}while(i==0);
}
int??guitai(?)?????????????//判斷輸入的柜臺號是否正確
{
int?y=0;
????printf(“請輸入你所辦理業(yè)務的柜臺號(1-3):\n“);
scanf(“%d“&y);
if(y<1||y>5)
{
printf(“你輸入的柜臺號有誤,請重新輸入!\n“);
????????printf(“請輸入你所辦理業(yè)務的柜臺號(1-3):\n“);
????scanf(“%d“&y);
}
else
printf(“?你所辦理業(yè)務的柜臺為%d.\n“y);
return?y;
????
}
int??pingfeng(?)?????????????//判斷輸入的分數(shù)是否正確
{
int?y=0;
????printf(“請輸入你評分(1-5):\n????????????????????1分…………非常不滿意;\n????????????????????2分…………比較不滿意;\n????????????????????3分…………一般滿意;\n????????????????????4分…………比較滿意;\n????????????????????5分…………非常滿意。\n“);
printf(“請輸入:“);
scanf(“%d“&y);
if(y<1||y>5)
{
printf(“你輸入評分有誤,請重新輸入!\n“);
????????printf(“請輸入你的評分(1-5):\n“);
????scanf(“%d“&y);
}
else
????printf(“?你的評分為%d.\n“y);
return?y;
????
}
void?mygrade()?????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????.CA....?????11534??2009-06-17?23:58??銀行排隊系統(tǒng)源程序\coolwind(1).cpp
????.CA....??????3463??2009-06-17?23:58??銀行排隊系統(tǒng)源程序\coolwind(1).dsp
????.CA....???????530??2009-06-18?00:04??銀行排隊系統(tǒng)源程序\coolwind(1).dsw
????.CA....?????50176??2009-06-18?00:04??銀行排隊系統(tǒng)源程序\coolwind(1).ncb
????.CA....?????48640??2009-06-18?00:04??銀行排隊系統(tǒng)源程序\coolwind(1).opt
????.CA....???????716??2009-06-17?23:58??銀行排隊系統(tǒng)源程序\coolwind(1).plg
????.CA....?????36352??2009-06-12?15:30??系統(tǒng)導航.doc
????.CA....????195072??2009-06-12?13:58??銀行排隊系統(tǒng)實驗報告.doc
????.C.D...?????????0??2009-07-02?22:49??銀行排隊系統(tǒng)源程序
-----------?---------??----------?-----??----
???????????????346483????????????????????9
- 上一篇:c++11的中文文檔
- 下一篇:VC++6.0寫的網(wǎng)絡爬蟲程序
評論
共有 條評論