⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 queue.lst

📁 以C8051F020单片机做的多功能计数器
💻 LST
字号:
C51 COMPILER V7.50   QUEUE                                                                 09/17/2008 12:03:00 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE QUEUE
OBJECT MODULE PLACED IN queue.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE queue.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include "queue.h"
*** ERROR C141 IN LINE 7 OF QUEUE.H: syntax error near 'e2', expected ')'
*** ERROR C136 IN LINE 8 OF QUEUE.H: 'History': 'void' on variable
*** ERROR C129 IN LINE 8 OF QUEUE.H: missing ';' before 'DeQueue'
   2          
   3          extern xdata double dCounter;;
   4          extern uchar MeasureType;
   5          
   6          void InitQueue(struct sqqueue *p) /*初始化队列*/
   7          {
   8                  p->front=0;
   9                  p->rear=0;
  10          }
  11          bit EnQueue(struct sqqueue *q, double e1,uchar e2;); /*入队*/
  12          {
  13                  if((q->rear+1)%maxsize==q->front)//判断队列是否满
  14                  return 0;
  15                  else
  16                  q->Counter[q->rear]=e1;//加入一个新的数据
  17                  q->type[q->rear]=e2;//加入一个新的数据
  18                  q->rear=(q->rear+1)%maxsize;//将队尾数加1
  19                  return 1;
  20          }
  21          void DeQueue(struct sqqueue *q)/*出队*/
  22          {
  23                  
  24                  if (q->front==q->rear)//判断队列是否为空
  25                          MeasureType=0;
  26                  else
  27                  {
  28                          e1=q->Counter[q->front];//提出队首数据
  29                          e2=q->type[q->front];//提出队首数据
  30                          q->front=(q->front+1)%maxsize;//改变队首
  31                  }
  32          }
  33          bit Empty(struct sqqueue *q)/*判断队列是否空*/
  34          {
  35                  bit v;
  36                  if (q->front==q->rear)//判断队列是否为空,
  37                  v=1;
  38                  else
  39                  v=0;
  40                  return v; 
  41          }
  42          
  43          /*
  44          unsigned char QueueFront(struct sqqueue *q)//获得队首元素
  45          {
  46                  unsigned char e;
  47                  if (q->front==q->rear) //判断队列是否为空
  48                  e=1;
  49                  else
  50                  e=q->hisData[q->front];
  51                  return e;
  52          }
C51 COMPILER V7.50   QUEUE                                                                 09/17/2008 12:03:00 PAGE 2   

  53          unsigned char QueueBack(struct sqqueue *q)
  54          {
  55                  unsigned char e;
  56                  if(q->front == q->rear)
  57                          e = -1;
  58                  else 
  59                          e = q->hisData[q->rear-1];
  60                  return e;
  61          }
  62          void Display(struct sqqueue *q)//从队首到队尾显示队列中的元素
  63          {
  64                  unsigned char s;
  65                  s=q->front;
  66                  //printf("队列中的元素为:\n");
  67                  if (q->front==q->rear)
  68                  //printf("队列为空!");
  69                  else
  70                  {
  71                          while(s<q->rear)
  72                          {
  73                          //printf(" %d <-", q->hisData[s]);
  74                          s=(s+1)%maxsize;
  75                          }
  76                          //printf("\n");
  77                  }
  78          }
  79          
  80          
  81          void queue()
  82          {
  83                  struct sqqueue queue,*head;
  84                  int x,y,select;
  85                  char ch='y';
  86                  head=&queue;
  87                  InitQueue(head);
  88                  //printf("一个空队列已经创建!\n");
  89                  while(ch=='y' || ch=='Y')
  90                  {
  91                  //printf("1: 入队列 \n");
  92                  //printf("2: 出队列 \n");
  93                  //printf("3: 判断队列是否空 \n");
  94                  //printf("4: 取队首元素 \n");
  95                  //printf("5: 取队尾元素 \n");
  96                  //printf("6: 显示队列\n");
  97                  //printf("请选择功能 (1~4):");
  98                  scanf("%d",&select);
  99                  switch(select)
 100                  {
 101                          case 1:
 102                          { 
 103                          //printf("请输入一个值: ");
 104                          scanf("%d",&x);
 105                          EnQueue(head,x);
 106                          Display(head);
 107                          break;
 108                          }
 109                          case 2:
 110                          {
 111                          DeQueue(head);
 112                          Display(head);
 113                          break;
 114                          }
C51 COMPILER V7.50   QUEUE                                                                 09/17/2008 12:03:00 PAGE 3   

 115                          case 3:
 116                          {
 117                          if(Empty(head))
 118                          //printf("队列为空\n");
 119                          else
 120                          //printf("队列不空\n");
 121                          break;
 122                          }
 123                          case 4:
 124                          {
 125                          y=QueueFront(head);
 126                          if(y)
 127                          //printf("队列为空");
 128                          else
 129                                  //printf("队首元素为: %d\n",y);
 130                          Display(head);
 131                          break;
 132                          }
 133                          case 5:
 134                          {
 135                                  y = QueueBack(head);
 136                                  if(y == -1)
 137                                          //printf("队列为空\n");
 138                                  else
 139                                          //printf("队尾元素为: %d\n",y);
 140                                  Display(head);
 141                                  break;
 142                          }
 143                          case 6:
 144                          {
 145                                  Display(head);
 146                          }
 147                  }
 148                  //printf("是否继续?(y/n)");
 149                  fflush(stdin);
 150                  ch=getchar();
 151                  }
 152          }
 153          
 154          
 155          void main()
 156          {
 157            queue();
 158          }*/

C51 COMPILATION COMPLETE.  0 WARNING(S),  3 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -