理财卡业务也可以在空闲的2、3、4号窗口之一办理。
客户领号、业务完成可以作为输入信息,要求可以随时显示6个营业窗口的状态。
#include \ #include \ #include \
typedef struct Cost {
void InitCL(CostList & CL , int number) { }
void PutCL(CostList & CL , int number) { }
void PopCL(CostList & CL , int & number) {
CostList p = CL ; if(CL == NULL) {
number = CL->num ; CL = CL->next ; number = 0 ; else
CostList p = CL , q; if(CL == NULL) { }
while(p->next)
p = p->next ;
q= (CostList)malloc(sizeof(Cost)) ; q->num = number ; p->next = q; q->next = NULL ; InitCL(CL , number) ; else
CL = (CostList)malloc(sizeof(Cost)) ; CL->num = number ; CL->next = NULL ; int num ; Cost * next ;
}Cost , * CostList ;
}
}
free( p ) ;
void ShowCL(CostList & CL) { }
int _tmain(int argc, _TCHAR* argv[]) {
int a[6] = {0}, n , costnum=0 , i = 0 , j = 0 , m; CostList CL1 = NULL ,CL2 = NULL , CL3 = NULL ; while(1) {
printf(\请选择业务种类\\n1.公积金业务\\n2.银行卡业务\\n3.理财卡业务\\n4.业务办理完scanf_s(\,&n) ; switch(n) { case 1 :
i++ ;
printf(\您的序号为:%d\\n\,i) ; if(CL1 == NULL)
InitCL(CL1 , i) ; PutCL(CL1 , i) ; else break ; i++ ;
printf(\您的序号为:%d\\n\,i) ; if(CL2 == NULL)
InitCL(CL2 , i) ; PutCL(CL2 , i) ; else break ;
CostList p = CL ; while(p) { }
printf(\) ;
printf(\,p->num ) ; p = p->next ;
成\\n5.显示当前窗口营业状态\\n6.显示当前排队情况\\n\) ;
case 2 :
case 3 :
}
i++ ;
printf(\您的序号为:%d\\n\,i) ; if(CL3 == NULL)
InitCL(CL3 , i) ; PutCL(CL3 , i) ; else break ;
printf(\正在营业的窗口:\\n\) ; for(j = 0 ; j < 6 ; j++) { }
printf(\);
printf(\请选择业务办理完成的窗口号:\\n\) ; scanf_s(\,&m) ; a[m-1] = 0; break ;
printf(\窗口营业情况:\\n\) ; for(j = 0 ; j < 6 ; j++) { } break ;
printf(\办理公积金业务的客户有:\\n\) ; ShowCL(CL1) ;
printf(\办理银行卡业务的客户有:\\n\) ; ShowCL(CL2) ;
printf(\办理理财卡业务的客户有:\\n\) ; ShowCL(CL3) ;
if(a[j] != 0)
printf(\号窗口正在为%d号客户服务\\n\,j+1 ,a[j]) ; if(a[j] != 0)
printf(\,j+1) ;
case 4 :
case 5 :
case 6 :
if(a[0] == 0) { }
if(a[4] == 0) {
PopCL(CL3 , costnum) ; a[4] = costnum ; PopCL(CL1 ,costnum) ; a[0] = costnum ;
}
if(a[5] == 0) { }
if(a[1] == 0) { }
if(a[2] == 0) { }
if(a[3] == 0) {
if(CL2 != NULL) { } else {
PopCL(CL3 , costnum) ; PopCL(CL2 , costnum) ; a[3] = costnum ; if(CL2 != NULL) { } else { }
PopCL(CL3 , costnum) ; a[2] = costnum ; PopCL(CL2 , costnum) ; a[2] = costnum ; if(CL2 != NULL) { } else { }
PopCL(CL3 , costnum) ; a[1] = costnum ; PopCL(CL2 , costnum) ; a[1] = costnum ; PopCL(CL3 , costnum) ; a[5] = costnum ;
} }
}
a[3] = costnum ;
system(\) ; return 0; }
5、4阶斐波那契序列如下:f0=f1=f2=0, f3=1,…,fi=fi-1+fi-2+fi-3+fi-4,
利用容量为k=4的循环队列,构造序列的前n+1项(f0, f1 , f2 ,… fn ),要求满足fn ≤200而fn+1 >200。
#include \ #include \ #include \
int f[100] = {0,0,0,1}; int count = 4 ; struct number { } ;
number * h ;
void InitCircle() { }
int i ;
number * p , * q = NULL ; for(i = 1 ; i < 5 ; i++) { }
q->next = h ;
h->next->next->next->n = 1 ;
p = (number *)malloc(sizeof(number)) ; p->n = 0 ; p->next = NULL ; if(i == 1) { }
q->next = p ; q = p ;
h = p ; q = p ;
int n ;
number * next ;