鱼C论坛

 找回密码
 立即注册
查看: 443|回复: 7

[已解决]急急急!为什么我的代码会出现 error C2065: 'destroyqueue1' : undeclared identi...

[复制链接]
发表于 2020-6-23 12:46:14 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
问题如下:
D:\数据结构课程设计\yhyw\yhyw.cpp(207) : error C2065: 'destroyqueue1' : undeclared identifier
D:\数据结构课程设计\yhyw\yhyw.cpp(208) : error C2065: 'destroyqueue2' : undeclared identifier
执行 cl.exe 时出错.


所有代码 如下:
//头文件
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<iostream.h>
#include<windows.h>


//宏定义
#define MONEY 5000//个人业务值,交易额上限
#define OK  1
#define ERROR  0
#define OVERFLOW  -2
typedef int status;

//定义的结构体
typedef struct
{
        int arrivetime;//到达时间
        int OccurTime;//事件发生时间
        int NType;//事件类型,0表示到达事件,1表示离开事件。同时用1表示存款,2表示取款。
        int duration;//办理业务时间
        long int money;//交易金额
}Event,ElemType1;
typedef struct
{
        //等待队列元素
        int arrivetime;//到达时间
        int duration;//办理业务时间
        long int money;//交易金额
}wait,ElemType2;
typedef struct QNode1
{
        ElemType1 data;
        struct QNode1 *next;
}QNode1,*Queue1;
typedef struct QNode2
{
        ElemType2 data;
        struct QNode2 *next;
}QNode2,*Queue2;
typedef struct
{
        Queue1 front;
        Queue1 rear;
}LinkQueue1;
typedef struct
{
        Queue2 front;
        Queue2 rear;
}LinkQueue2;

//全局变量
long int total_money;//银行现存资金总额
int total_time;//客户逗留总时间
int use_time;//每个客户所用时间
int money;//每个客户办理的金额
int closetime;//银行营业时间
int INTERTIME;//下一个用户到达的时间间隔
int DURATION;//办理业务所需时间
int number;//办理业务的次序
int time1;//系统当前时间
LinkQueue1 Q1;
LinkQueue2 Q2;
Event en;//事件
wait en1;//队列2元素

//初始化队列1
status InitQueue1()
{
        Q1.front=Q1.rear=(Queue1)malloc(sizeof(QNode1));
        if(!Q1.front)exit(OVERFLOW);
        Q1.front->next=NULL;
        return OK;
}

//初始化队列2
status InitQueue2()
{
        Q2.front=Q2.rear=(Queue2)malloc(sizeof(QNode2));
        if(!Q2.front)exit(OVERFLOW);
        Q2.front->next=NULL;
        return OK;
}

//销毁队列1
status destoryqueue1()
{
        while(Q1.front)
        {
                Q1.rear=Q1.front->next;
                free(Q1.front);
                Q1.front=Q1.rear;
        }
        return OK;
}

//销毁队列2
status destoryqueue2()
{
        while(Q2.front)
        {
                Q2.rear=Q2.front->next;
                free(Q2.front);
                Q2.front=Q2.rear;
        }
        return OK;
}

//队列1入队列
status EnQueue1()
{
        Queue1 p,r,r1;
        p=(Queue1)malloc(sizeof(QNode1));
        if(!p)exit(OVERFLOW);
        p->data.arrivetime=en.arrivetime;
        p->data.OccurTime=en.OccurTime;
        p->data.NType=en.NType;
        p->data.duration=en.duration;
        p->data.money=en.money;
        r=Q1.front->next;
        while(r)
        {
                if(p->data.arrivetime<r->data.arrivetime)
                {
                        if(r==Q1.front->next)
                        {
                                p->next=r;
                                Q1.front->next=p;
                        }
                        else
                        {
                                r1->next=p;
                                p->next=r;
                        }
                }
                r1=r;r=r->next;
        }
        if(!r)
        {
                if(Q1.front->next==NULL)
                {
                        Q1.front->next=p;
                        Q1.rear=p;
                        Q1.rear->next=NULL;
                }
                else
                {
                        p->next=NULL;
                        Q1.rear->next=p;
                        Q1.rear=p;
                }
        }
        return OK;
}

//队列2入队列
status EnQueue2()
{
        Queue2 p;
        p=(Queue2)malloc(sizeof(QNode2));
        if(!p)exit(OVERFLOW);
        p->data.arrivetime=en1.arrivetime;
        p->data.duration=en1.duration;
        p->data.money=en1.money;
        p->next=NULL;
        Q2.rear->next=p;
        Q2.rear=p;
        return OK;
}

//若队列1不空,则删除Q1的队头元素,并用en返回其值
status DeQueue1()
{
        Queue1 p;
        if(Q1.front=Q1.rear) return ERROR;
        p=Q1.front->next;
        en.arrivetime=p->data.arrivetime;
        en.OccurTime=p->data.OccurTime;
        en.NType=p->data.NType;
        en.duration=p->data.duration;
        en.money=p->data.money;
        Q1.front->next=p->next;
        if(Q1.rear==p) Q1.rear=Q1.front;//只有一个人时
        free(p);
        return OK;
}

//若队列2不空,则删除Q2的队头元素,并用en1返回其值
status DeQueue2()
{
        Queue2 p;
        if(Q2.front==Q2.rear)return ERROR;
        p=Q2.front->next;
        en1.arrivetime=p->data.arrivetime;
        en1.duration=p->data.duration;
        en1.money=p->data.money;
        Q2.front->next=p->next;
        if(Q2.rear==p) Q2.rear=Q2.front;//只有一个人时
        free(p);
        return OK;
}

//营业时间结束,全部客户离开银行
void free_system()
{
        destroyqueue1();
        destroyqueue2();
}

//产生随机数
status rand_ar(int *intertime,long int *money,int *duration,int *NType)
{
        *intertime=rand()%INTERTIME+1;//下个客户到达的时间间隔,不大于INTERTIME
        *money=rand()%MONEY+1;//每个顾客办理的金额,不大于MONEY
        *duration=rand()%DURATION+1;//客户办理业务所需时间,不大于DURATION
        *NType=rand()%2;//事件类型分为0和1两种
        return OK;
}

//初始化操作
void OpenForDay()
{
        printf("请输入银行的初始存款:");
        scanf("%d",&total_money);
        printf("请输入银行的营业时间(分钟):");
        scanf("%d",&closetime);
        printf("请输入最大到达时间间隔(分钟):");
        scanf("%d",&INTERTIME);
        printf("请输入最短处理时间(分钟):");
        scanf("%d",&DURATION);
        total_time=0;//客户逗留总时间(初始值)
        number=0;//办理业务的次序(初始值)
        InitQueue1();//初始化队列1
        InitQueue2();//初始化队列2
        en.arrivetime=0;//到达时间
        en.OccurTime=0;//事件发生时间
        en.NType=0;//事件类型,暂时值
        en.money=0;//交易金额,暂时值
        en.duration=0;//办理业务时间,暂时值
        EnQueue1();//事件进队列
}

//查找上一离开事件的发生时间
int find_leave()
{
        Queue1 p;
        int i=0;
        p=Q1.front->next;
        while(p!=NULL)
        {
                if(p->data.NType!=0)
                        i=p->data.OccurTime;
                p=p->next;
        }
        return i;
}

//处理客户到达事件
void CustomerArrived()
{
        int intertime;
        int i;
        time1=en.OccurTime;
        rand_ar(&intertime,&(en.money),&(en.duration),&(en.NType));
        //设置一离开事件插入事件表
        en.NType++;//0变1,1变2
        i=find_leave();//查找上一离开事件的发生时间
        if(i==0)//第一位顾客
                en.OccurTime=en.arrivetime+en.duration;
        else
                if(i>=en.arrivetime)//本事件到达时上一事件还未离开
                        en.OccurTime=i+en.duration;//则此事件的离开时间=上一事件的离开时间+本事件处理时间
                else//上一事件离开之后,本事件才到达
                        en.OccurTime=en.arrivetime+en.duration;//则此事件的离开时间=本事件到达时间+本事件处理时间
                EnQueue1();//设置下一用户到达事件插入队列1
                en.arrivetime=en.arrivetime+intertime;//下一用户到达时间
                en.OccurTime=en.arrivetime;
                en.NType=0;//暂时值
                en.money=0;//暂时值
                en.duration=0;//暂时值
                EnQueue1();
}

//返回队列2的长度
int getlong_q2()
{
        int i=0;
        Queue2 p;
        p=Q2.front->next;
        while(p)
        {
                i++;
                p=p->next;
        }
        return i;
}

//顺序检查队列2是否有满足条件者
status check_q2()
{
        int i,j,z=0;
        i=getlong_q2();//用i返回队列2长度
        for(j=1;j<=i;j++)
        {
                DeQueue2();//队列2出队,用en1返回其值
                if(en1.money<=total_money)//若队列2出队元素的需要交易的金额<=银行现存金额,则可以办理
                {
                        if(time1>closetime)
                        {
                                printf("--\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n",z,use_time,number,z,
                                        (en1.arrivetime),en1.money);
                        }
                        else
                        {
                                time1=time1+en1.duration;//更新系统当前时间
                                use_time=time1-en1.arrivetime;
                                total_time+=use_time;//更新逗留时间
                                total_money-=en1.money;//更新资金总额
                                number++;//更新实现交易的用户数
                                printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t-%d\n",total_money,use_time,number,time1,(en1.arrivetime),(en1.money));
                        }
                }
                else
                {//若队列2出队元素的要交易的金额>银行现存金额,不能办理
                        if(time1>closetime)
                        {
                                printf("--\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n",z,use_time,
                                        number,z,(en1.arrivetime),en1.money);
                        }
                        else
                        {
                                EnQueue2();//继续插入队列的队尾,继续等待
                        }
                }
        }
        return OK;
}

//队列1离开时间减duraion(业务办理时间)
int cut_duration(int e)//e是形参,指代办理业务的时间
{
        Queue1 p,q,r;
        ElemType1 en;
        p=Q1.front->next;
        r=Q1.front;
        if(p)
        {
                if(p->data.NType!=0)
                {
                        q=p->next;
                        r->next=q;//删除结点
                        en.arrivetime=p->data.arrivetime;//到达时间
                        en.OccurTime=p->data.OccurTime-e;//事件发生时间
                        en.NType=p->data.NType;//事件类型
                        en.duration=p->data.duration;//办理业务时间
                        en.money=p->data.money;//数额
                        free(p);
                        EnQueue1();
                }
        }
        return OK;
}

//处理客户离开事件
void CustomerDeparture()
{
        int i;
        i=en.NType;//业务类型,1表示存款,2表示取款
        time1=en.OccurTime-en.duration;
        if(i==OK)//是否是办理存款
        {
                if(en.OccurTime>closetime)//营业结束,全部客户离开银行
                        free_system();
                else//营业时间没有结束,继续办理
                {
                        use_time=en.OccurTime-en.arrivetime;
                        total_time+=use_time;//更新逗留的总时间
                        total_money=total_money+en.money;//更新资金总额
                        number++;//更新服务的客户数
                        time1=en.OccurTime;//更新系统当前时间
                        printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n",total_money,use_time,number,en.OccurTime,en.arrivetime,en.money);
                                check_q2();//检查队列2是否有满足条件者
                }
        }
        else//办理取款
        {
                if(en.money>total_money)//办理取款,当申请金额不能满足时,离开队列1进入队列2等待
                {
                        cut_duration(en.duration);//从队列1中删除该结点
                        en1.arrivetime=en.arrivetime;
                        en1.duration=en.duration;
                        en1.money=en.money;
                        EnQueue2();//进入队列2继续等待
                }
                else//办理取款,当能满足所申请金额时进行队列1
                {
                        if(en.OccurTime>closetime)//营业结束,全部客户离开银行
                                free_system();
                        else
                        {
                                use_time=en.OccurTime-en.arrivetime;//顾客所用时间=事件发生时间-事件到达时间
                                total_time+=use_time;//更新逗留时间
                                total_money-=en.money;//更新资金总额
                                time1=en.OccurTime;//更新系统当前时间
                                number++;//更新客户总数
                                printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t-%d\n",total_money,use_time,number,en.OccurTime,en.arrivetime,en.money);
                        }
                }
        }
}

//主函数
void main()
{
        int n;
        printf("========================================\n");
        printf("       欢迎使用银行业务模拟系统\n");
        printf("----------------------------------------");
        printf("          班级:测绘1703班 \n");
        printf("          姓名:陈 蕾      \n");
        printf("          学号:631701110304\n");
        printf("========================================\n");
        printf("请选择开始或结束:\n");
        printf("1.进入银行业务模拟系统\n");
        printf("0.退出程序\n");
        scanf("%d",&n);
        while(n==1)
        {
                OpenForDay();//初始化操作
                printf("----------------------------------------\n");
                printf("Total_money\tuse_time\tnumber\ten.OccurTime\ten.arrivetime\tmoney\n");
                {
                        while(Q1.front)
                        {
                                DeQueue1();//队列1出队列,并用en返回其值
                                if(en.NType==0)//en.NType等于0表示客户到达,1表示客户离开
                                        CustomerArrived();//处理客户到达事件
                                else
                                        CustomerDeparture();//处理客户离开事件,业务类型en.NType等于1表示存款,2表示取款
                        }
                        printf("1.营业结束后银行现存资金总额(元):%1d\n",total_money);
                        printf("2.营业时间内实现交易的客户数(人):%d\n",number);
                        printf("3.客户在银行逗留的总时间(分钟):%d\n",total_time);
                        printf("4.客户在银行的平均逗留时间(分钟):%f\n",(float)total_time/(float)number);
                        printf("----------------------------------------");
                }
                printf("以上为模拟结果!请选择继续或退出:\n");
                printf("1.继续模拟\n");
                printf("0.退出程序\n");
                scanf("%d",&n);
                if(n==0)
                {
                        printf("谢谢使用本系统,再见!");
                        break;
                }
        }
}
最佳答案
2020-6-23 14:28:56
拼写错误。
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4. #include<windows.h>


  5. //宏定义
  6. #define MONEY 5000//个人业务值,交易额上限
  7. #define OK  1
  8. #define ERROR  0
  9. #define OVERFLOW  -2
  10. typedef int status;

  11. //定义的结构体
  12. typedef struct
  13. {
  14.     int arrivetime;//到达时间
  15.     int OccurTime;//事件发生时间
  16.     int NType;//事件类型,0表示到达事件,1表示离开事件。同时用1表示存款,2表示取款。
  17.     int duration;//办理业务时间
  18.     long int money;//交易金额
  19. }Event, ElemType1;
  20. typedef struct
  21. {
  22.     //等待队列元素
  23.     int arrivetime;//到达时间
  24.     int duration;//办理业务时间
  25.     long int money;//交易金额
  26. }wait, ElemType2;
  27. typedef struct QNode1
  28. {
  29.     ElemType1 data;
  30.     struct QNode1* next;
  31. }QNode1, * Queue1;
  32. typedef struct QNode2
  33. {
  34.     ElemType2 data;
  35.     struct QNode2* next;
  36. }QNode2, * Queue2;
  37. typedef struct
  38. {
  39.     Queue1 front;
  40.     Queue1 rear;
  41. }LinkQueue1;
  42. typedef struct
  43. {
  44.     Queue2 front;
  45.     Queue2 rear;
  46. }LinkQueue2;

  47. //全局变量
  48. long int total_money;//银行现存资金总额
  49. int total_time;//客户逗留总时间
  50. int use_time;//每个客户所用时间
  51. int money;//每个客户办理的金额
  52. int closetime;//银行营业时间
  53. int INTERTIME;//下一个用户到达的时间间隔
  54. int DURATION;//办理业务所需时间
  55. int number;//办理业务的次序
  56. int time1;//系统当前时间
  57. LinkQueue1 Q1;
  58. LinkQueue2 Q2;
  59. Event en;//事件
  60. wait en1;//队列2元素

  61. //初始化队列1
  62. status InitQueue1()
  63. {
  64.     Q1.front = Q1.rear = (Queue1)malloc(sizeof(QNode1));
  65.     if (!Q1.front)exit(OVERFLOW);
  66.     Q1.front->next = NULL;
  67.     return OK;
  68. }

  69. //初始化队列2
  70. status InitQueue2()
  71. {
  72.     Q2.front = Q2.rear = (Queue2)malloc(sizeof(QNode2));
  73.     if (!Q2.front)exit(OVERFLOW);
  74.     Q2.front->next = NULL;
  75.     return OK;
  76. }

  77. //销毁队列1
  78. status destroyqueue1()
  79. {
  80.     while (Q1.front)
  81.     {
  82.         Q1.rear = Q1.front->next;
  83.         free(Q1.front);
  84.         Q1.front = Q1.rear;
  85.     }
  86.     return OK;
  87. }

  88. //销毁队列2
  89. status destroyqueue2()
  90. {
  91.     while (Q2.front)
  92.     {
  93.         Q2.rear = Q2.front->next;
  94.         free(Q2.front);
  95.         Q2.front = Q2.rear;
  96.     }
  97.     return OK;
  98. }

  99. //队列1入队列
  100. status EnQueue1()
  101. {
  102.     Queue1 p, r, r1;
  103.     p = (Queue1)malloc(sizeof(QNode1));
  104.     if (!p)exit(OVERFLOW);
  105.     p->data.arrivetime = en.arrivetime;
  106.     p->data.OccurTime = en.OccurTime;
  107.     p->data.NType = en.NType;
  108.     p->data.duration = en.duration;
  109.     p->data.money = en.money;
  110.     r = Q1.front->next;
  111.     while (r)
  112.     {
  113.         if (p->data.arrivetime < r->data.arrivetime)
  114.         {
  115.             if (r == Q1.front->next)
  116.             {
  117.                 p->next = r;
  118.                 Q1.front->next = p;
  119.             }
  120.             else
  121.             {
  122.                 r1->next = p;
  123.                 p->next = r;
  124.             }
  125.         }
  126.         r1 = r; r = r->next;
  127.     }
  128.     if (!r)
  129.     {
  130.         if (Q1.front->next == NULL)
  131.         {
  132.             Q1.front->next = p;
  133.             Q1.rear = p;
  134.             Q1.rear->next = NULL;
  135.         }
  136.         else
  137.         {
  138.             p->next = NULL;
  139.             Q1.rear->next = p;
  140.             Q1.rear = p;
  141.         }
  142.     }
  143.     return OK;
  144. }

  145. //队列2入队列
  146. status EnQueue2()
  147. {
  148.     Queue2 p;
  149.     p = (Queue2)malloc(sizeof(QNode2));
  150.     if (!p)exit(OVERFLOW);
  151.     p->data.arrivetime = en1.arrivetime;
  152.     p->data.duration = en1.duration;
  153.     p->data.money = en1.money;
  154.     p->next = NULL;
  155.     Q2.rear->next = p;
  156.     Q2.rear = p;
  157.     return OK;
  158. }

  159. //若队列1不空,则删除Q1的队头元素,并用en返回其值
  160. status DeQueue1()
  161. {
  162.     Queue1 p;
  163.     if (Q1.front = Q1.rear) return ERROR;
  164.     p = Q1.front->next;
  165.     en.arrivetime = p->data.arrivetime;
  166.     en.OccurTime = p->data.OccurTime;
  167.     en.NType = p->data.NType;
  168.     en.duration = p->data.duration;
  169.     en.money = p->data.money;
  170.     Q1.front->next = p->next;
  171.     if (Q1.rear == p) Q1.rear = Q1.front;//只有一个人时
  172.     free(p);
  173.     return OK;
  174. }

  175. //若队列2不空,则删除Q2的队头元素,并用en1返回其值
  176. status DeQueue2()
  177. {
  178.     Queue2 p;
  179.     if (Q2.front == Q2.rear)return ERROR;
  180.     p = Q2.front->next;
  181.     en1.arrivetime = p->data.arrivetime;
  182.     en1.duration = p->data.duration;
  183.     en1.money = p->data.money;
  184.     Q2.front->next = p->next;
  185.     if (Q2.rear == p) Q2.rear = Q2.front;//只有一个人时
  186.     free(p);
  187.     return OK;
  188. }

  189. //营业时间结束,全部客户离开银行
  190. void free_system()
  191. {
  192.     destroyqueue1();
  193.     destroyqueue2();
  194. }

  195. //产生随机数
  196. status rand_ar(int* intertime, long int* money, int* duration, int* NType)
  197. {
  198.     *intertime = rand() % INTERTIME + 1;//下个客户到达的时间间隔,不大于INTERTIME
  199.     *money = rand() % MONEY + 1;//每个顾客办理的金额,不大于MONEY
  200.     *duration = rand() % DURATION + 1;//客户办理业务所需时间,不大于DURATION
  201.     *NType = rand() % 2;//事件类型分为0和1两种
  202.     return OK;
  203. }

  204. //初始化操作
  205. void OpenForDay()
  206. {
  207.     printf("请输入银行的初始存款:");
  208.     scanf("%d", &total_money);
  209.     printf("请输入银行的营业时间(分钟):");
  210.     scanf("%d", &closetime);
  211.     printf("请输入最大到达时间间隔(分钟):");
  212.     scanf("%d", &INTERTIME);
  213.     printf("请输入最短处理时间(分钟):");
  214.     scanf("%d", &DURATION);
  215.     total_time = 0;//客户逗留总时间(初始值)
  216.     number = 0;//办理业务的次序(初始值)
  217.     InitQueue1();//初始化队列1
  218.     InitQueue2();//初始化队列2
  219.     en.arrivetime = 0;//到达时间
  220.     en.OccurTime = 0;//事件发生时间
  221.     en.NType = 0;//事件类型,暂时值
  222.     en.money = 0;//交易金额,暂时值
  223.     en.duration = 0;//办理业务时间,暂时值
  224.     EnQueue1();//事件进队列
  225. }

  226. //查找上一离开事件的发生时间
  227. int find_leave()
  228. {
  229.     Queue1 p;
  230.     int i = 0;
  231.     p = Q1.front->next;
  232.     while (p != NULL)
  233.     {
  234.         if (p->data.NType != 0)
  235.             i = p->data.OccurTime;
  236.         p = p->next;
  237.     }
  238.     return i;
  239. }

  240. //处理客户到达事件
  241. void CustomerArrived()
  242. {
  243.     int intertime;
  244.     int i;
  245.     time1 = en.OccurTime;
  246.     rand_ar(&intertime, &(en.money), &(en.duration), &(en.NType));
  247.     //设置一离开事件插入事件表
  248.     en.NType++;//0变1,1变2
  249.     i = find_leave();//查找上一离开事件的发生时间
  250.     if (i == 0)//第一位顾客
  251.         en.OccurTime = en.arrivetime + en.duration;
  252.     else
  253.         if (i >= en.arrivetime)//本事件到达时上一事件还未离开
  254.             en.OccurTime = i + en.duration;//则此事件的离开时间=上一事件的离开时间+本事件处理时间
  255.         else//上一事件离开之后,本事件才到达
  256.             en.OccurTime = en.arrivetime + en.duration;//则此事件的离开时间=本事件到达时间+本事件处理时间
  257.     EnQueue1();//设置下一用户到达事件插入队列1
  258.     en.arrivetime = en.arrivetime + intertime;//下一用户到达时间
  259.     en.OccurTime = en.arrivetime;
  260.     en.NType = 0;//暂时值
  261.     en.money = 0;//暂时值
  262.     en.duration = 0;//暂时值
  263.     EnQueue1();
  264. }

  265. //返回队列2的长度
  266. int getlong_q2()
  267. {
  268.     int i = 0;
  269.     Queue2 p;
  270.     p = Q2.front->next;
  271.     while (p)
  272.     {
  273.         i++;
  274.         p = p->next;
  275.     }
  276.     return i;
  277. }

  278. //顺序检查队列2是否有满足条件者
  279. status check_q2()
  280. {
  281.     int i, j, z = 0;
  282.     i = getlong_q2();//用i返回队列2长度
  283.     for (j = 1; j <= i; j++)
  284.     {
  285.         DeQueue2();//队列2出队,用en1返回其值
  286.         if (en1.money <= total_money)//若队列2出队元素的需要交易的金额<=银行现存金额,则可以办理
  287.         {
  288.             if (time1 > closetime)
  289.             {
  290.                 printf("--\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n", z, use_time, number, z,
  291.                     (en1.arrivetime), en1.money);
  292.             }
  293.             else
  294.             {
  295.                 time1 = time1 + en1.duration;//更新系统当前时间
  296.                 use_time = time1 - en1.arrivetime;
  297.                 total_time += use_time;//更新逗留时间
  298.                 total_money -= en1.money;//更新资金总额
  299.                 number++;//更新实现交易的用户数
  300.                 printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t-%d\n", total_money, use_time, number, time1, (en1.arrivetime), (en1.money));
  301.             }
  302.         }
  303.         else
  304.         {//若队列2出队元素的要交易的金额>银行现存金额,不能办理
  305.             if (time1 > closetime)
  306.             {
  307.                 printf("--\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n", z, use_time,
  308.                     number, z, (en1.arrivetime), en1.money);
  309.             }
  310.             else
  311.             {
  312.                 EnQueue2();//继续插入队列的队尾,继续等待
  313.             }
  314.         }
  315.     }
  316.     return OK;
  317. }

  318. //队列1离开时间减duraion(业务办理时间)
  319. int cut_duration(int e)//e是形参,指代办理业务的时间
  320. {
  321.     Queue1 p, q, r;
  322.     ElemType1 en;
  323.     p = Q1.front->next;
  324.     r = Q1.front;
  325.     if (p)
  326.     {
  327.         if (p->data.NType != 0)
  328.         {
  329.             q = p->next;
  330.             r->next = q;//删除结点
  331.             en.arrivetime = p->data.arrivetime;//到达时间
  332.             en.OccurTime = p->data.OccurTime - e;//事件发生时间
  333.             en.NType = p->data.NType;//事件类型
  334.             en.duration = p->data.duration;//办理业务时间
  335.             en.money = p->data.money;//数额
  336.             free(p);
  337.             EnQueue1();
  338.         }
  339.     }
  340.     return OK;
  341. }

  342. //处理客户离开事件
  343. void CustomerDeparture()
  344. {
  345.     int i;
  346.     i = en.NType;//业务类型,1表示存款,2表示取款
  347.     time1 = en.OccurTime - en.duration;
  348.     if (i == OK)//是否是办理存款
  349.     {
  350.         if (en.OccurTime > closetime)//营业结束,全部客户离开银行
  351.             free_system();
  352.         else//营业时间没有结束,继续办理
  353.         {
  354.             use_time = en.OccurTime - en.arrivetime;
  355.             total_time += use_time;//更新逗留的总时间
  356.             total_money = total_money + en.money;//更新资金总额
  357.             number++;//更新服务的客户数
  358.             time1 = en.OccurTime;//更新系统当前时间
  359.             printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n", total_money, use_time, number, en.OccurTime, en.arrivetime, en.money);
  360.             check_q2();//检查队列2是否有满足条件者
  361.         }
  362.     }
  363.     else//办理取款
  364.     {
  365.         if (en.money > total_money)//办理取款,当申请金额不能满足时,离开队列1进入队列2等待
  366.         {
  367.             cut_duration(en.duration);//从队列1中删除该结点
  368.             en1.arrivetime = en.arrivetime;
  369.             en1.duration = en.duration;
  370.             en1.money = en.money;
  371.             EnQueue2();//进入队列2继续等待
  372.         }
  373.         else//办理取款,当能满足所申请金额时进行队列1
  374.         {
  375.             if (en.OccurTime > closetime)//营业结束,全部客户离开银行
  376.                 free_system();
  377.             else
  378.             {
  379.                 use_time = en.OccurTime - en.arrivetime;//顾客所用时间=事件发生时间-事件到达时间
  380.                 total_time += use_time;//更新逗留时间
  381.                 total_money -= en.money;//更新资金总额
  382.                 time1 = en.OccurTime;//更新系统当前时间
  383.                 number++;//更新客户总数
  384.                 printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t-%d\n", total_money, use_time, number, en.OccurTime, en.arrivetime, en.money);
  385.             }
  386.         }
  387.     }
  388. }

  389. //主函数
  390. void main()
  391. {
  392.     int n;
  393.     printf("========================================\n");
  394.     printf("       欢迎使用银行业务模拟系统\n");
  395.     printf("----------------------------------------");
  396.     printf("          班级:测绘1703班 \n");
  397.     printf("          姓名:陈 蕾      \n");
  398.     printf("          学号:631701110304\n");
  399.     printf("========================================\n");
  400.     printf("请选择开始或结束:\n");
  401.     printf("1.进入银行业务模拟系统\n");
  402.     printf("0.退出程序\n");
  403.     scanf("%d", &n);
  404.     while (n == 1)
  405.     {
  406.         OpenForDay();//初始化操作
  407.         printf("----------------------------------------\n");
  408.         printf("Total_money\tuse_time\tnumber\ten.OccurTime\ten.arrivetime\tmoney\n");
  409.         {
  410.             while (Q1.front)
  411.             {
  412.                 DeQueue1();//队列1出队列,并用en返回其值
  413.                 if (en.NType == 0)//en.NType等于0表示客户到达,1表示客户离开
  414.                     CustomerArrived();//处理客户到达事件
  415.                 else
  416.                     CustomerDeparture();//处理客户离开事件,业务类型en.NType等于1表示存款,2表示取款
  417.             }
  418.             printf("1.营业结束后银行现存资金总额(元):%1d\n", total_money);
  419.             printf("2.营业时间内实现交易的客户数(人):%d\n", number);
  420.             printf("3.客户在银行逗留的总时间(分钟):%d\n", total_time);
  421.             printf("4.客户在银行的平均逗留时间(分钟):%f\n", (float)total_time / (float)number);
  422.             printf("----------------------------------------");
  423.         }
  424.         printf("以上为模拟结果!请选择继续或退出:\n");
  425.         printf("1.继续模拟\n");
  426.         printf("0.退出程序\n");
  427.         scanf("%d", &n);
  428.         if (n == 0)
  429.         {
  430.             printf("谢谢使用本系统,再见!");
  431.             break;
  432.         }
  433.     }
  434. }
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-6-23 12:47:03 | 显示全部楼层
是一个动态模拟银行业务的系统
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-23 13:09:51 | 显示全部楼层
求一位大佬解救
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-6-23 14:28:56 | 显示全部楼层    本楼为最佳答案   
拼写错误。
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4. #include<windows.h>


  5. //宏定义
  6. #define MONEY 5000//个人业务值,交易额上限
  7. #define OK  1
  8. #define ERROR  0
  9. #define OVERFLOW  -2
  10. typedef int status;

  11. //定义的结构体
  12. typedef struct
  13. {
  14.     int arrivetime;//到达时间
  15.     int OccurTime;//事件发生时间
  16.     int NType;//事件类型,0表示到达事件,1表示离开事件。同时用1表示存款,2表示取款。
  17.     int duration;//办理业务时间
  18.     long int money;//交易金额
  19. }Event, ElemType1;
  20. typedef struct
  21. {
  22.     //等待队列元素
  23.     int arrivetime;//到达时间
  24.     int duration;//办理业务时间
  25.     long int money;//交易金额
  26. }wait, ElemType2;
  27. typedef struct QNode1
  28. {
  29.     ElemType1 data;
  30.     struct QNode1* next;
  31. }QNode1, * Queue1;
  32. typedef struct QNode2
  33. {
  34.     ElemType2 data;
  35.     struct QNode2* next;
  36. }QNode2, * Queue2;
  37. typedef struct
  38. {
  39.     Queue1 front;
  40.     Queue1 rear;
  41. }LinkQueue1;
  42. typedef struct
  43. {
  44.     Queue2 front;
  45.     Queue2 rear;
  46. }LinkQueue2;

  47. //全局变量
  48. long int total_money;//银行现存资金总额
  49. int total_time;//客户逗留总时间
  50. int use_time;//每个客户所用时间
  51. int money;//每个客户办理的金额
  52. int closetime;//银行营业时间
  53. int INTERTIME;//下一个用户到达的时间间隔
  54. int DURATION;//办理业务所需时间
  55. int number;//办理业务的次序
  56. int time1;//系统当前时间
  57. LinkQueue1 Q1;
  58. LinkQueue2 Q2;
  59. Event en;//事件
  60. wait en1;//队列2元素

  61. //初始化队列1
  62. status InitQueue1()
  63. {
  64.     Q1.front = Q1.rear = (Queue1)malloc(sizeof(QNode1));
  65.     if (!Q1.front)exit(OVERFLOW);
  66.     Q1.front->next = NULL;
  67.     return OK;
  68. }

  69. //初始化队列2
  70. status InitQueue2()
  71. {
  72.     Q2.front = Q2.rear = (Queue2)malloc(sizeof(QNode2));
  73.     if (!Q2.front)exit(OVERFLOW);
  74.     Q2.front->next = NULL;
  75.     return OK;
  76. }

  77. //销毁队列1
  78. status destroyqueue1()
  79. {
  80.     while (Q1.front)
  81.     {
  82.         Q1.rear = Q1.front->next;
  83.         free(Q1.front);
  84.         Q1.front = Q1.rear;
  85.     }
  86.     return OK;
  87. }

  88. //销毁队列2
  89. status destroyqueue2()
  90. {
  91.     while (Q2.front)
  92.     {
  93.         Q2.rear = Q2.front->next;
  94.         free(Q2.front);
  95.         Q2.front = Q2.rear;
  96.     }
  97.     return OK;
  98. }

  99. //队列1入队列
  100. status EnQueue1()
  101. {
  102.     Queue1 p, r, r1;
  103.     p = (Queue1)malloc(sizeof(QNode1));
  104.     if (!p)exit(OVERFLOW);
  105.     p->data.arrivetime = en.arrivetime;
  106.     p->data.OccurTime = en.OccurTime;
  107.     p->data.NType = en.NType;
  108.     p->data.duration = en.duration;
  109.     p->data.money = en.money;
  110.     r = Q1.front->next;
  111.     while (r)
  112.     {
  113.         if (p->data.arrivetime < r->data.arrivetime)
  114.         {
  115.             if (r == Q1.front->next)
  116.             {
  117.                 p->next = r;
  118.                 Q1.front->next = p;
  119.             }
  120.             else
  121.             {
  122.                 r1->next = p;
  123.                 p->next = r;
  124.             }
  125.         }
  126.         r1 = r; r = r->next;
  127.     }
  128.     if (!r)
  129.     {
  130.         if (Q1.front->next == NULL)
  131.         {
  132.             Q1.front->next = p;
  133.             Q1.rear = p;
  134.             Q1.rear->next = NULL;
  135.         }
  136.         else
  137.         {
  138.             p->next = NULL;
  139.             Q1.rear->next = p;
  140.             Q1.rear = p;
  141.         }
  142.     }
  143.     return OK;
  144. }

  145. //队列2入队列
  146. status EnQueue2()
  147. {
  148.     Queue2 p;
  149.     p = (Queue2)malloc(sizeof(QNode2));
  150.     if (!p)exit(OVERFLOW);
  151.     p->data.arrivetime = en1.arrivetime;
  152.     p->data.duration = en1.duration;
  153.     p->data.money = en1.money;
  154.     p->next = NULL;
  155.     Q2.rear->next = p;
  156.     Q2.rear = p;
  157.     return OK;
  158. }

  159. //若队列1不空,则删除Q1的队头元素,并用en返回其值
  160. status DeQueue1()
  161. {
  162.     Queue1 p;
  163.     if (Q1.front = Q1.rear) return ERROR;
  164.     p = Q1.front->next;
  165.     en.arrivetime = p->data.arrivetime;
  166.     en.OccurTime = p->data.OccurTime;
  167.     en.NType = p->data.NType;
  168.     en.duration = p->data.duration;
  169.     en.money = p->data.money;
  170.     Q1.front->next = p->next;
  171.     if (Q1.rear == p) Q1.rear = Q1.front;//只有一个人时
  172.     free(p);
  173.     return OK;
  174. }

  175. //若队列2不空,则删除Q2的队头元素,并用en1返回其值
  176. status DeQueue2()
  177. {
  178.     Queue2 p;
  179.     if (Q2.front == Q2.rear)return ERROR;
  180.     p = Q2.front->next;
  181.     en1.arrivetime = p->data.arrivetime;
  182.     en1.duration = p->data.duration;
  183.     en1.money = p->data.money;
  184.     Q2.front->next = p->next;
  185.     if (Q2.rear == p) Q2.rear = Q2.front;//只有一个人时
  186.     free(p);
  187.     return OK;
  188. }

  189. //营业时间结束,全部客户离开银行
  190. void free_system()
  191. {
  192.     destroyqueue1();
  193.     destroyqueue2();
  194. }

  195. //产生随机数
  196. status rand_ar(int* intertime, long int* money, int* duration, int* NType)
  197. {
  198.     *intertime = rand() % INTERTIME + 1;//下个客户到达的时间间隔,不大于INTERTIME
  199.     *money = rand() % MONEY + 1;//每个顾客办理的金额,不大于MONEY
  200.     *duration = rand() % DURATION + 1;//客户办理业务所需时间,不大于DURATION
  201.     *NType = rand() % 2;//事件类型分为0和1两种
  202.     return OK;
  203. }

  204. //初始化操作
  205. void OpenForDay()
  206. {
  207.     printf("请输入银行的初始存款:");
  208.     scanf("%d", &total_money);
  209.     printf("请输入银行的营业时间(分钟):");
  210.     scanf("%d", &closetime);
  211.     printf("请输入最大到达时间间隔(分钟):");
  212.     scanf("%d", &INTERTIME);
  213.     printf("请输入最短处理时间(分钟):");
  214.     scanf("%d", &DURATION);
  215.     total_time = 0;//客户逗留总时间(初始值)
  216.     number = 0;//办理业务的次序(初始值)
  217.     InitQueue1();//初始化队列1
  218.     InitQueue2();//初始化队列2
  219.     en.arrivetime = 0;//到达时间
  220.     en.OccurTime = 0;//事件发生时间
  221.     en.NType = 0;//事件类型,暂时值
  222.     en.money = 0;//交易金额,暂时值
  223.     en.duration = 0;//办理业务时间,暂时值
  224.     EnQueue1();//事件进队列
  225. }

  226. //查找上一离开事件的发生时间
  227. int find_leave()
  228. {
  229.     Queue1 p;
  230.     int i = 0;
  231.     p = Q1.front->next;
  232.     while (p != NULL)
  233.     {
  234.         if (p->data.NType != 0)
  235.             i = p->data.OccurTime;
  236.         p = p->next;
  237.     }
  238.     return i;
  239. }

  240. //处理客户到达事件
  241. void CustomerArrived()
  242. {
  243.     int intertime;
  244.     int i;
  245.     time1 = en.OccurTime;
  246.     rand_ar(&intertime, &(en.money), &(en.duration), &(en.NType));
  247.     //设置一离开事件插入事件表
  248.     en.NType++;//0变1,1变2
  249.     i = find_leave();//查找上一离开事件的发生时间
  250.     if (i == 0)//第一位顾客
  251.         en.OccurTime = en.arrivetime + en.duration;
  252.     else
  253.         if (i >= en.arrivetime)//本事件到达时上一事件还未离开
  254.             en.OccurTime = i + en.duration;//则此事件的离开时间=上一事件的离开时间+本事件处理时间
  255.         else//上一事件离开之后,本事件才到达
  256.             en.OccurTime = en.arrivetime + en.duration;//则此事件的离开时间=本事件到达时间+本事件处理时间
  257.     EnQueue1();//设置下一用户到达事件插入队列1
  258.     en.arrivetime = en.arrivetime + intertime;//下一用户到达时间
  259.     en.OccurTime = en.arrivetime;
  260.     en.NType = 0;//暂时值
  261.     en.money = 0;//暂时值
  262.     en.duration = 0;//暂时值
  263.     EnQueue1();
  264. }

  265. //返回队列2的长度
  266. int getlong_q2()
  267. {
  268.     int i = 0;
  269.     Queue2 p;
  270.     p = Q2.front->next;
  271.     while (p)
  272.     {
  273.         i++;
  274.         p = p->next;
  275.     }
  276.     return i;
  277. }

  278. //顺序检查队列2是否有满足条件者
  279. status check_q2()
  280. {
  281.     int i, j, z = 0;
  282.     i = getlong_q2();//用i返回队列2长度
  283.     for (j = 1; j <= i; j++)
  284.     {
  285.         DeQueue2();//队列2出队,用en1返回其值
  286.         if (en1.money <= total_money)//若队列2出队元素的需要交易的金额<=银行现存金额,则可以办理
  287.         {
  288.             if (time1 > closetime)
  289.             {
  290.                 printf("--\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n", z, use_time, number, z,
  291.                     (en1.arrivetime), en1.money);
  292.             }
  293.             else
  294.             {
  295.                 time1 = time1 + en1.duration;//更新系统当前时间
  296.                 use_time = time1 - en1.arrivetime;
  297.                 total_time += use_time;//更新逗留时间
  298.                 total_money -= en1.money;//更新资金总额
  299.                 number++;//更新实现交易的用户数
  300.                 printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t-%d\n", total_money, use_time, number, time1, (en1.arrivetime), (en1.money));
  301.             }
  302.         }
  303.         else
  304.         {//若队列2出队元素的要交易的金额>银行现存金额,不能办理
  305.             if (time1 > closetime)
  306.             {
  307.                 printf("--\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n", z, use_time,
  308.                     number, z, (en1.arrivetime), en1.money);
  309.             }
  310.             else
  311.             {
  312.                 EnQueue2();//继续插入队列的队尾,继续等待
  313.             }
  314.         }
  315.     }
  316.     return OK;
  317. }

  318. //队列1离开时间减duraion(业务办理时间)
  319. int cut_duration(int e)//e是形参,指代办理业务的时间
  320. {
  321.     Queue1 p, q, r;
  322.     ElemType1 en;
  323.     p = Q1.front->next;
  324.     r = Q1.front;
  325.     if (p)
  326.     {
  327.         if (p->data.NType != 0)
  328.         {
  329.             q = p->next;
  330.             r->next = q;//删除结点
  331.             en.arrivetime = p->data.arrivetime;//到达时间
  332.             en.OccurTime = p->data.OccurTime - e;//事件发生时间
  333.             en.NType = p->data.NType;//事件类型
  334.             en.duration = p->data.duration;//办理业务时间
  335.             en.money = p->data.money;//数额
  336.             free(p);
  337.             EnQueue1();
  338.         }
  339.     }
  340.     return OK;
  341. }

  342. //处理客户离开事件
  343. void CustomerDeparture()
  344. {
  345.     int i;
  346.     i = en.NType;//业务类型,1表示存款,2表示取款
  347.     time1 = en.OccurTime - en.duration;
  348.     if (i == OK)//是否是办理存款
  349.     {
  350.         if (en.OccurTime > closetime)//营业结束,全部客户离开银行
  351.             free_system();
  352.         else//营业时间没有结束,继续办理
  353.         {
  354.             use_time = en.OccurTime - en.arrivetime;
  355.             total_time += use_time;//更新逗留的总时间
  356.             total_money = total_money + en.money;//更新资金总额
  357.             number++;//更新服务的客户数
  358.             time1 = en.OccurTime;//更新系统当前时间
  359.             printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t%d\n", total_money, use_time, number, en.OccurTime, en.arrivetime, en.money);
  360.             check_q2();//检查队列2是否有满足条件者
  361.         }
  362.     }
  363.     else//办理取款
  364.     {
  365.         if (en.money > total_money)//办理取款,当申请金额不能满足时,离开队列1进入队列2等待
  366.         {
  367.             cut_duration(en.duration);//从队列1中删除该结点
  368.             en1.arrivetime = en.arrivetime;
  369.             en1.duration = en.duration;
  370.             en1.money = en.money;
  371.             EnQueue2();//进入队列2继续等待
  372.         }
  373.         else//办理取款,当能满足所申请金额时进行队列1
  374.         {
  375.             if (en.OccurTime > closetime)//营业结束,全部客户离开银行
  376.                 free_system();
  377.             else
  378.             {
  379.                 use_time = en.OccurTime - en.arrivetime;//顾客所用时间=事件发生时间-事件到达时间
  380.                 total_time += use_time;//更新逗留时间
  381.                 total_money -= en.money;//更新资金总额
  382.                 time1 = en.OccurTime;//更新系统当前时间
  383.                 number++;//更新客户总数
  384.                 printf("%1d\t\t%d\t\t%d\t\t%d\t\t%d\t-%d\n", total_money, use_time, number, en.OccurTime, en.arrivetime, en.money);
  385.             }
  386.         }
  387.     }
  388. }

  389. //主函数
  390. void main()
  391. {
  392.     int n;
  393.     printf("========================================\n");
  394.     printf("       欢迎使用银行业务模拟系统\n");
  395.     printf("----------------------------------------");
  396.     printf("          班级:测绘1703班 \n");
  397.     printf("          姓名:陈 蕾      \n");
  398.     printf("          学号:631701110304\n");
  399.     printf("========================================\n");
  400.     printf("请选择开始或结束:\n");
  401.     printf("1.进入银行业务模拟系统\n");
  402.     printf("0.退出程序\n");
  403.     scanf("%d", &n);
  404.     while (n == 1)
  405.     {
  406.         OpenForDay();//初始化操作
  407.         printf("----------------------------------------\n");
  408.         printf("Total_money\tuse_time\tnumber\ten.OccurTime\ten.arrivetime\tmoney\n");
  409.         {
  410.             while (Q1.front)
  411.             {
  412.                 DeQueue1();//队列1出队列,并用en返回其值
  413.                 if (en.NType == 0)//en.NType等于0表示客户到达,1表示客户离开
  414.                     CustomerArrived();//处理客户到达事件
  415.                 else
  416.                     CustomerDeparture();//处理客户离开事件,业务类型en.NType等于1表示存款,2表示取款
  417.             }
  418.             printf("1.营业结束后银行现存资金总额(元):%1d\n", total_money);
  419.             printf("2.营业时间内实现交易的客户数(人):%d\n", number);
  420.             printf("3.客户在银行逗留的总时间(分钟):%d\n", total_time);
  421.             printf("4.客户在银行的平均逗留时间(分钟):%f\n", (float)total_time / (float)number);
  422.             printf("----------------------------------------");
  423.         }
  424.         printf("以上为模拟结果!请选择继续或退出:\n");
  425.         printf("1.继续模拟\n");
  426.         printf("0.退出程序\n");
  427.         scanf("%d", &n);
  428.         if (n == 0)
  429.         {
  430.             printf("谢谢使用本系统,再见!");
  431.             break;
  432.         }
  433.     }
  434. }
复制代码
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-23 15:29:06 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-23 15:30:28 | 显示全部楼层
问题如下:
D:\数据结构课程设计\yhyw\yhyw.cpp(207) : error C2065: 'destroyqueue1' : undeclared identifier
D:\数据结构课程设计\yhyw\yhyw.cpp(208) : error C2065: 'destroyqueue2' : undeclared identifier
执行 cl.exe 时出错.

对应的行是
//营业时间结束,全部客户离开银行
void free_system()
{
        destroyqueue1();
        destroyqueue2();
}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-23 15:38:41 | 显示全部楼层

我对比代码看到了  现在的问题已经解决了 我调试一下功能 先谢谢你啦
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2020-6-23 16:39:22 | 显示全部楼层
printf("1.营业结束后银行现存资金总额(元):%1d\n", total_money);
            printf("2.营业时间内实现交易的客户数(人):%d\n", number);
            printf("3.客户在银行逗留的总时间(分钟):%d\n", total_time);
            printf("4.客户在银行的平均逗留时间(分钟):%f\n", (float)total_time / (float)number);
            printf("----------------------------------------");

这一部分代码怎么成功显示呀??
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-1 03:57

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表