同時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..