同时rear和len分别指示环形队列中队尾元素的位置和内含元素的个数。设计相应的入队和出队算法。
上传时间: 2014-01-06
上传用户:1966640071
针对目前汽车追尾事件频发问题,提出一种防汽车车前和车后追尾的安全装置设计。该设计以高性能、低功耗的8位AVR微处理器ATmega8L为核心,结合霍尔式车速传感器、激光雷达测距装置和MMA7260QT加速度传感器,能够兼顾车前和车后,摒弃以往设计中只考虑车前或车后单一性缺点,尤其适用于高速、夜晚或新手行车。 Abstract: Aiming at the high frequency of vehicle rear-end collision,a safe device design of anti-vehicle rear-end collision is presented.In the design,the high-performance,low-power8-bit AVR microprocessor ATmega8L is utilized as a core combined with Hall-type speed sensor,laser-radar ranging devices and the acceleration sensor MMA7260QT.The design considers both the front and back of a car,and overcomes the drawbacks of former designs in which only the front or the back of the car is considered,so it is especially suitable for high-speed,night or the beginner’s driving.
上传时间: 2013-10-14
上传用户:GavinNeko
介绍一种应用于长城赛弗SUV汽车后门车窗多功能控制器,能实现对电动玻璃车窗、车窗雨刮器、喷水器以及电加热除霜器等控制。介绍了基于NXP P89LPC922单片机多功能汽车后车窗控制器的控制功能、硬件电路原理和软件设计方法。 Abstract: This paper presents a multipurpose automotive rear windows controller for CHANGCHENG SAFE SUV.The controller can control rear power-operated window,rear wiping,washing water pump and rear defroster of the windows. In this paper, it is introduced in detail that the functions and the design of the circuit and program of the controller based on NXP P89LPC922 MCU.
上传时间: 2013-11-13
上传用户:z754970244
各功能描述: 1. 当A为低电平时,AC-3灯点亮,即是AC-3的输入方式 当A为高电平时,STEREO灯点亮,即是STEREO的输入方式 2. 当STANDBY灯点亮时,为待机状态;此LED闪动时为MUTE状态,PT2258为静音状态,同时STANDBY为低电平 3. 各声道(FRONT,SUB,rear,CENT)其微调音量调节+/-5dB;音量调节从01~80dB 4. 面板无任何按键,均为遥控器控制 5. 刚开机时为待机状态,开机时音量为50dB状态,各微调为0dB, 6. 按遥控器的REST键后,系统为开机时状态, 7. PT2258音量衰减共80DB,按遥控器每按一次衰减1dB,
上传时间: 2016-12-30
上传用户:VRMMO
多媒体5.1声道遥控功放全套方案(原理图+制作元件参数全套)各功能描述: 1. 当A为低电平时,AC-3灯点亮,即是AC-3的输入方式 当A为高电平时,STEREO灯点亮,即是STEREO的输入方式 2. 当STANDBY灯点亮时,为待机状态;此LED闪动时为MUTE状态,PT2258为静音状态,同时STANDBY为低电平 3. 各声道(FRONT,SUB,rear,CENT)其微调音量调节+/-5dB;音量调节从01~80dB 4. 面板无任何按键,均为遥控器控制 5. 刚开机时为待机状态,开机时音量为50dB状态,各微调为0dB, 6. 按遥控器的REST键后,系统为开机时状态, 7. PT2258音量衰减共80DB,按遥控器每按一次衰减1dB,
上传时间: 2017-02-21
上传用户:黄华强
#include <iostream> #include <stdio.head> #include <stdlib.head> #include <string.head> #define ElemType int #define max 100 using namespace std; typedef struct node1 { ElemType data; struct node1 *next; }Node1,*LinkList;//链栈 typedef struct { ElemType *base; int top; }SqStack;//顺序栈 typedef struct node2 { ElemType data; struct node2 *next; }Node2,*LinkQueue; typedef struct node22 { LinkQueue front; LinkQueue rear; }*LinkList;//链队列 typedef struct { ElemType *base; int front,rear; }SqQueue;//顺序队列 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 //1.采用链式存储实现栈的初始化、入栈、出栈操作。 LinkList CreateStack()//创建栈 { LinkList top; top=NULL; return top; } bool StackEmpty(LinkList s)//判断栈是否为空,0代表空 { if(s==NULL) return 0; else return 1; } LinkList Pushead(LinkList s,int x)//入栈 { LinkList q,top=s; q=(LinkList)malloc(sizeof(Node1)); q->data=x; q->next=top; top=q; return top; } LinkList Pop(LinkList s,int &e)//出栈 { if(!StackEmpty(s)) { printf("栈为空。"); } else { e=s->data; LinkList p=s; s=s->next; free(p); } return s; } void DisplayStack(LinkList s)//遍历输出栈中元素 { if(!StackEmpty(s)) printf("栈为空。"); else { wheadile(s!=NULL) { cout<<s->data<<" "; s=s->next; } cout<<endl; } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 //2.采用顺序存储实现栈的初始化、入栈、出栈操作。 int StackEmpty(int t)//判断栈S是否为空 { SqStack.top=t; if (SqStack.top==0) return 0; else return 1; } int InitStack() { SqStack.top=0; return SqStack.top; } int pushead(int t,int e) { SqStack.top=t; SqStack.base[++SqStack.top]=e; return SqStack.top; } int pop(int t,int *e)//出栈 { SqStack.top=t; if(!StackEmpty(SqStack.top)) { printf("栈为空."); return SqStack.top; } *e=SqStack.base[s.top]; SqStack.top--; return SqStack.top; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 //3.采用链式存储实现队列的初始化、入队、出队操作。 LinkList InitQueue()//创建 { LinkList head; head->rear=(LinkQueue)malloc(sizeof(Node)); head->front=head->rear; head->front->next=NULL; return head; } void deleteEle(LinkList head,int &e)//出队 { LinkQueue p; p=head->front->next; e=p->data; head->front->next=p->next; if(head->rear==p) head->rear=head->front; free(p); } void EnQueue(LinkList head,int e)//入队 { LinkQueue p=(LinkQueue)malloc(sizeof(Node)); p->data=e; p->next=NULL; head->rear->next=p; head->rear=p; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 //4.采用顺序存储实现循环队列的初始化、入队、出队操作。 bool InitQueue(SqQueue &head)//创建队列 { head.data=(int *)malloc(sizeof(int)); head.front=head.rear=0; return 1; } bool EnQueue(SqQueue &head,int e)//入队 { if((head.rear+1)%MAXQSIZE==head.front) { printf("队列已满\n"); return 0; } head.data[head.rear]=e; head.rear=(head.rear+1)%MAXQSIZE; return 1; } int QueueLengthead(SqQueue &head)//返回队列长度 { return (head.rear-head.front+MAXQSIZE)%MAXQSIZE; } bool deleteEle(SqQueue &head,int &e)//出队 { if(head.front==head.rear) { cout<<"队列为空!"<<endl; return 0; } e=head.data[head.front]; head.front=(head.front+1)%MAXQSIZE; return 1; } int gethead(SqQueue head)//得到队列头元素 { return head.data[head.front]; } int QueueEmpty(SqQueue head)//判断队列是否为空 { if (head.front==head.rear) return 1; else return 0; } void travelQueue(SqQueue head)//遍历输出 { wheadile(head.front!=head.rear) { printf("%d ",head.data[head.front]); head.front=(head.front+1)%MAXQSIZE; } cout<<endl; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 //5.在主函数中设计一个简单的菜单,分别测试上述算法。 int main() { LinkList top=CreateStack(); int x; wheadile(scanf("%d",&x)!=-1) { top=Pushead(top,x); } int e; wheadile(StackEmpty(top)) { top=Pop(top,e); printf("%d ",e); }//以上是链栈的测试 int top=InitStack(); int x; wheadile(cin>>x) top=pushead(top,x); int e; wheadile(StackEmpty(top)) { top=pop(top,&e); printf("%d ",e); }//以上是顺序栈的测试 LinkList Q; Q=InitQueue(); int x; wheadile(scanf("%d",&x)!=-1) { EnQueue(Q,x); } int e; wheadile(Q) { deleteEle(Q,e); printf("%d ",e); }//以上是链队列的测试 SqQueue Q1; InitQueue(Q1); int x; wheadile(scanf("%d",&x)!=-1) { EnQueue(Q1,x); } int e; wheadile(QueueEmpty(Q1)) { deleteEle(Q1,e); printf("%d ",e); } return 0; }
上传时间: 2018-05-09
上传用户:123456..