虫虫首页|资源下载|资源专辑|精品软件
登录|注册

Hwang-Li

  • 数据结构实验

    #include <stdio.h>   #include <stdlib.h> ///链式栈      typedef struct node   {       int data;       struct node *next;   }Node,*Linklist;      Linklist Createlist()   {       Linklist p;       Linklist h;       int data1;       scanf("%d",&data1);       if(data1 != 0)       {           h = (Node *)malloc(sizeof(Node));           h->data = data1;           h->next = NULL;       }       else if(data1 == 0)       return NULL;       scanf("%d",&data1);       while(data1 != 0)       {           p = (Node *)malloc(sizeof(Node));           p -> data = data1;           p -> next = h;           h = p;           scanf("%d",&data1);       }       return h;   }      void Outputlist(Node *head)   {       Linklist p;       p = head;       while(p != NULL )       {           printf("%d ",p->data);           p = p->next;       }       printf("\n");   }      void Freelist(Node *head)   {       Node *p;       Node *q = NULL;       p = head;       while(p != NULL)       {           q = p;           p = p->next;           free(q);       }   }      int main()   {       Node *head;       head = Createlist();          Outputlist(head);          Freelist(head);          return 0;   }   2.顺序栈 [cpp] view plain copy #include <iostream>   #include <stdio.h>   #include <stdlib.h> ///顺序栈   #define MaxSize 100      using namespace std;      typedef

    标签: 数据结构 实验

    上传时间: 2018-05-09

    上传用户:123456..

  • 数据结构实验

    #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..

  • 基于MSP430和STM32无线通信系统的设

    基于MSP430和STM32无线通信系统的设

    标签: MSP 430 STM 32 无线通信系统

    上传时间: 2018-05-15

    上传用户:lili8899xyz

  • 有限差分法

    function [alpha,N,U]=youxianchafen2(r1,r2,up,under,num,deta)      %[alpha,N,U]=youxianchafen2(a,r1,r2,up,under,num,deta)   %该函数用有限差分法求解有两种介质的正方形区域的二维拉普拉斯方程的数值解   %函数返回迭代因子、迭代次数以及迭代完成后所求区域内网格节点处的值   %a为正方形求解区域的边长   %r1,r2分别表示两种介质的电导率   %up,under分别为上下边界值   %num表示将区域每边的网格剖分个数   %deta为迭代过程中所允许的相对误差限      n=num+1; %每边节点数   U(n,n)=0; %节点处数值矩阵   N=0; %迭代次数初值   alpha=2/(1+sin(pi/num));%超松弛迭代因子   k=r1/r2; %两介质电导率之比   U(1,1:n)=up; %求解区域上边界第一类边界条件   U(n,1:n)=under; %求解区域下边界第一类边界条件   U(2:num,1)=0;U(2:num,n)=0;      for i=2:num   U(i,2:num)=up-(up-under)/num*(i-1);%采用线性赋值对上下边界之间的节点赋迭代初值   end   G=1;   while G>0 %迭代条件:不满足相对误差限要求的节点数目G不为零   Un=U; %完成第n次迭代后所有节点处的值   G=0; %每完成一次迭代将不满足相对误差限要求的节点数目归零   for j=1:n   for i=2:num   U1=U(i,j); %第n次迭代时网格节点处的值      if j==1 %第n+1次迭代左边界第二类边界条件   U(i,j)=1/4*(2*U(i,j+1)+U(i-1,j)+U(i+1,j));   end         if (j>1)&&(j                 U2=1/4*(U(i,j+1)+ U(i-1,j)+ U(i,j-1)+ U(i+1,j));    U(i,j)=U1+alpha*(U2-U1); %引入超松弛迭代因子后的网格节点处的值      end      if i==n+1-j %第n+1次迭代两介质分界面(与网格对角线重合)第二类边界条件   U(i,j)=1/4*(2/(1+k)*(U(i,j+1)+U(i+1,j))+2*k/(1+k)*(U(i-1,j)+U(i,j-1)));      end      if j==n %第n+1次迭代右边界第二类边界条件   U(i,n)=1/4*(2*U(i,j-1)+U(i-1,j)+U(i+1,j));   end   end   end   N=N+1 %显示迭代次数   Un1=U; %完成第n+1次迭代后所有节点处的值   err=abs((Un1-Un)./Un1);%第n+1次迭代与第n次迭代所有节点值的相对误差   err(1,1:n)=0; %上边界节点相对误差置零   err(n,1:n)=0; %下边界节点相对误差置零    G=sum(sum(err>deta))%显示每次迭代后不满足相对误差限要求的节点数目G   end

    标签: 有限差分

    上传时间: 2018-07-13

    上传用户:Kemin

  • css美化有序列表

    css美化有序列表,贴出部分css代码         <ol >             <li>先涂粉底再涂防晒</li>             <li>先涂防晒再涂粉底</li>         </ol> <!doctype html> <html> <head> <title>CSS3 ordered list styles - demo</title> <style> body{ margin: 40px auto; width: 500px; } /* -------------------------------------- */ ol{ counter-reset: li; list-style: none; *list-style: decimal; font: 15px 'trebuchet MS', 'lucida sans'; padding: 0; margin-bottom: 4em; text-shadow: 0 1px 0 rgba(255,255,255,.5); } ol ol{ margin: 0 0 0 2em; } /* -------------------------------------- */

    标签: css 美化 序列

    上传时间: 2018-08-21

    上传用户:53660542

  • JAVA SMPP 源码

    Introduction jSMPP is a java implementation (SMPP API) of the SMPP protocol (currently supports SMPP v3.4). It provides interfaces to communicate with a Message Center or an ESME (External Short Message Entity) and is able to handle traffic of 3000-5000 messages per second. jSMPP is not a high-level library. People looking for a quick way to get started with SMPP may be better of using an abstraction layer such as the Apache Camel SMPP component: http://camel.apache.org/smpp.html Travis-CI status: History The project started on Google Code: http://code.google.com/p/jsmpp/ It was maintained by uudashr on Github until 2013. It is now a community project maintained at http://jsmpp.org Release procedure mvn deploy -DperformRelease=true -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -Dgpg.passphrase=<yourpassphrase> log in here: https://oss.sonatype.org click the 'Staging Repositories' link select the repository and click close select the repository and click release License Copyright (C) 2007-2013, Nuruddin Ashr uudashr@gmail.com Copyright (C) 2012-2013, Denis Kostousov denis.kostousov@gmail.com Copyright (C) 2014, Daniel Pocock http://danielpocock.com Copyright (C) 2016, Pim Moerenhout pim.moerenhout@gmail.com This project is licensed under the Apache Software License 2.0.

    标签: JAVA SMPP 源码

    上传时间: 2019-01-25

    上传用户:dragon_longer

  • ASFAFA

    SUAFGAFI

    标签: ASFAFAAKLF AF

    上传时间: 2019-04-14

    上传用户:1653775774

  • 仙剑vs版

    Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005

    标签: 游戏

    上传时间: 2019-07-19

    上传用户:cmpcmp

  • HW2710

    短距离无线数据传输相关领域 包括智能家居控制、智能灯光控制、无线航模/四轴飞行器遥控器、智能电动车控制器、遥控玩具及童车控制等 应用优势

    标签: 2710 HW

    上传时间: 2019-08-28

    上传用户:tdw193

  • HW2071

    应用领域:无线航模、无线键盘、鼠标、智能家居、及其它无线数据传输和远程控制等  

    标签: 2071 HW

    上传时间: 2019-08-28

    上传用户:tdw193