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

mso-char-indent-count

  • 二叉树子系统

    #include<stdio.h> #define TREEMAX 100 typedef struct  BT { char data; BT *lchild; BT *rchild; }BT; BT *CreateTree(); void Preorder(BT *T); void Postorder(BT *T); void Inorder(BT *T); void Leafnum(BT *T); void Nodenum(BT *T); int TreeDepth(BT *T); int count=0; void main() { BT *T=NULL; char ch1,ch2,a; ch1='y'; while(ch1=='y'||ch1=='y') { printf("\n"); printf("\n\t\t             二叉树子系统"); printf("\n\t\t*****************************************"); printf("\n\t\t           1---------建二叉树            "); printf("\n\t\t           2---------先序遍历            "); printf("\n\t\t           3---------中序遍历            "); printf("\n\t\t           4---------后序遍历            "); printf("\n\t\t           5---------求叶子数            "); printf("\n\t\t           6---------求结点数            "); printf("\n\t\t           7---------求树深度            "); printf("\n\t\t           0---------返    回            "); printf("\n\t\t*****************************************"); printf("\n\t\t      请选择菜单号 (0--7)"); scanf("%c",&ch2); getchar(); printf("\n"); switch(ch2) { case'1': printf("\n\t\t请按先序序列输入二叉树的结点:\n"); printf("\n\t\t说明:输入结点(‘0’代表后继结点为空)后按回车。\n"); printf("\n\t\t请输入根结点:"); T=CreateTree(); printf("\n\t\t二叉树成功建立!\n");break; case'2': printf("\n\t\t该二叉树的先序遍历序列为:"); Preorder(T);break; case'3': printf("\n\t\t该二叉树的中序遍历序列为:"); Inorder(T);break; case'4': printf("\n\t\t该二叉树的后序遍历序列为:"); Postorder(T);break; case'5': count=0;Leafnum(T); printf("\n\t\t该二叉树有%d个叶子。\n",count);break; case'6': count=0;Nodenum(T); printf("\n\t\t该二叉树总共有%d个结点。\n",count);break; case'7': printf("\n\t\t该树的深度为:%d",TreeDepth(T)); break; case'0': ch1='n';break; default: printf("\n\t\t***请注意:输入有误!***"); } if(ch2!='0') { printf("\n\n\t\t按【Enter】键继续,按任意键返回主菜单!\n"); a=getchar(); if(a!='\xA') { getchar(); ch1='n'; } } } } BT *CreateTree() { BT *t; char x; scanf("%c",&x); getchar(); if(x=='0') t=NULL; else { t=new BT; t->data=x; printf("\n\t\t请输入%c结点的左子结点:",t->data);         t->lchild=CreateTree(); printf("\n\t\t请输入%c结点的右子结点:",t->data);         t->rchild=CreateTree();     } return t; } void Preorder(BT *T) { if(T) { printf("%3c",T->data); Preorder(T->lchild); Preorder(T->rchild); } } void Inorder(BT *T) { if(T) { Inorder(T->lchild); printf("%3c",T->data); Inorder(T->rchild); } } void Postorder(BT *T) { if(T) { Postorder(T->lchild); Postorder(T->rchild); printf("%3c",T->data); } } void Leafnum(BT *T) { if(T) { if(T->lchild==NULL&&T->rchild==NULL) count++; Leafnum(T->lchild); Leafnum(T->rchild); } } void Nodenum(BT *T) { if(T) { count++; Nodenum(T->lchild); Nodenum(T->rchild); } } int TreeDepth(BT *T) { int ldep,rdep; if(T==NULL) return 0; else { ldep=TreeDepth(T->lchild); rdep=TreeDepth(T->rchild); if(ldep>rdep) return ldep+1; else return rdep+1; } }

    标签: 二叉树 子系统

    上传时间: 2020-06-11

    上传用户:ccccy

  • 温度控制的PID算法的C语言程序.

    #nclude<reg51.h>#include<intrins.h>#销nclude<math.h>#include<string.h>struct PID{unsigned int SetPoint;//设定目标 Desired Value unsigned int Proportion;//比例常数Proportional Const unsigned int integral;//积分常数Integral Const unsigned int Derivative://微分常数Derivative Const unsigned int LastError;//Emorl-1]unsigned int PrevError;//Errorl-2]unsigned int SumError;//Sums of Errors struct PID spid;//PID Control Structure unsigned int rout;//PID Response(Output)unsigned int rin://PID Feedback(Input)sbit data1=P100;sbit clk=P141;sbit plus=P240;sbit subs=P241:sbit stop=P22;sbit output=P34;sbit DQ=P33;unsigned char flag,flag_1=0;unsigned char high_time,low_time,.count=0,/占空比调节参数unsigned char set_temper=35;unsigned char temper;unsigned chari:unsigned charj=0;unsigned ints;

    标签: 温度控制 pid算法 C语言

    上传时间: 2022-07-02

    上传用户:xsr1983

  • Ascii码的88点阵数据.rar

    Ascii码的8*8点阵数据,竖着排的。 code unsigned char asc5x8dot[96][5]={//ASC码0x20~0x7f

    标签: Ascii 点阵 数据

    上传时间: 2013-04-24

    上传用户:HGH77P99

  • 3des加密算法及调用示例.rar

    调用方法(加密》解密》加密): unsigned char key1[] = "12345678"; unsigned char key2[] = "abcdefgh"; unsigned char key3[] = "~!@#$%^&"; //如果只需要两组密钥,则本组密钥可以和密钥1一样。 unsigned char en_data[] = "龙的子孙"; unsigned char en_out_put[8]; //3DES 加密 des(en_data, key1, en_out_put, DES_ENCRYPT); des(en_out_put, key2, en_data, DES_DECRYPT); des(en_data, key3, en_out_put, DES_ENCRYPT);

    标签: 3des 加密算法

    上传时间: 2013-07-10

    上传用户:Poppy

  • 基于ARM的TimeToCount辐射测量仪的研究

    随着半导体工艺的飞速发展和芯片设计水平的不断进步,ARM微处理器的性能得到大幅度地提高,同时其芯片的价格也在不断下降,嵌入式系统以其独有的优势,己经广泛地渗透到科学研究和日常生活的各个方面。 本文以ARM7 LPC2132处理器为核心,结合盖革一弥勒计数管对Time-To-Count辐射测量方法进行研究。ARM结构是基于精简指令集计算机(RISC)原理而设计的,其指令集和相关的译码机制比复杂指令集计算机要简单得多,使用一个小的、廉价的ARM微处理器就可实现很高的指令吞吐量和实时的中断响应。基于ARM7TDMI-S核的LPC2132微处理器,其工作频率可达到60MHz,这对于Time-To-Count技术是非常有利的,而且利用LPC2132芯片的定时/计数器引脚捕获功能,可以直接读取TC中的计数值,也就是说不再需要调用中断函数读取TC值,从而大大降低了计数前杂质时间。本文是在我师兄吕军的《Time-To-Count测量方法初步研究》基础上,使用了高速的ARM芯片,对基于MCS-51的Time-To-Count辐射测量系统进行了改进,进一步论证了采用高速ARM处理器芯片可以极大的提高G-M计数器的测量范围与测量精度。 首先,讨论了传统的盖革-弥勒计数管探测射线强度的方法,并指出传统的脉冲测量方法的不足。然后讨论了什么是Time-To-Count测量方法,对Time-To-Count测量方法的理论基础进行分析。指出Time-To-Count方法与传统的脉冲计数方法的区别,以及采用Time-To-Count方法进行辐射测量的可行性。 接着,详细论述基于ARM7 LPC2132处理器的Time-To-Count辐射测量仪的原理、功能、特点以及辐射测量仪的各部分接口电路设计及相关程序的编制。 最后得出结论,通过高速32位ARM处理器的使用,Time-To-Count辐射测量仪的精度和量程均得到很大的提高,对于Y射线总量测量,使用了ARM处理器的Time-To-Count辐射测量仪的量程约为20 u R/h到1R/h,数据线性程度也比以前的Time-To-CotJnt辐射测量仪要好。所以在使用Time-To-Count方法进行的辐射测量时,如何减少杂质时间以及如何提高计数前时间的测量精度,是决定Time-To-Count辐射测量仪性能的关键因素。实验用三只相同型号的J33G-M计数管分别作为探测元件,在100U R/h到lR/h的辐射场中进行试验.每个测量点测量5次取平均,得出随着照射量率的增大,辐射强度R的测量值偏小且与辐射真实值之间的误差也随之增大。如果将测量误差限定在10%的范围内,则此仪器的量程范围为20 u R/h至1R/h,量程跨度近六个数量级。而用J33型G-M计数管作常规的脉冲测量,量程范围约为50 u R/h到5000 u R/h,充分体现了运用Time-To-Count方法测量辐射强度的优越性,也从另一个角度反应了随着计数前时间的逐渐减小,杂质时间在其中的比重越来越大,对测量结果的影响也就越来越严重,尽可能的减小杂质时间在Time-To-Count方法辐射测量特别是测量高强度辐射中是关键的。笔者用示波器测出此辐射仪器的杂质时间约为6.5 u S,所以在计算定时器值的时候减去这个杂质时间,可以增加计数前时间的精确度。通过实验得出,在标定仪器的K值时,应该在照射量率较低的条件下行,而测得的计数前时间是否精确则需要在照射量率较高的条件下通过仪器标定来检验。这是因为在照射量率较低时,计数前时间较大,杂质时间对测量结果的影响不明显,数据线斜率较稳定,适宜于确定标定系数K值,而在照射量率较高时,计数前时间很小,杂质时间对测量结果的影响较大,可以明显的在数据线上反映出来,从而可以很好的反应出仪器的性能与量程。实验证明了Time-To-Count测量方法中最为关键的环节就是如何对计数前时间进行精确测量。经过对大量实验数据的分析,得到计数前时间中的杂质时间可分为硬件杂质时间和软件杂质时间,并以软件杂质时间为主,通过对程序进行合理优化,软件杂质时间可以通过程序的改进而减少,甚至可以用数学补偿的方法来抵消,从而可以得到比较精确的计数前时间,以此得到较精确的辐射强度值。对于本辐射仪,用户可以选择不同的工作模式来进行测量,当辐射场较弱时,通常采用规定次数测量的方式,在辐射场较强时,应该选用定时测量的方式。因为,当辐射场较弱时,如果用规定次数测量的方式,会浪费很多时间来采集足够的脉冲信号。当辐射场较强时,由于辐射粒子很多,产生脉冲的频率就很高,规定次数的测量会加大测量误差,当选用定时测量的方式时,由于时间的相对加长,所以记录的粒子数就相对的增加,从而提高仪器的测量精度。通过调研国内外先进核辐射测量仪器的发展现状,了解到了目前最新的核辐射总量测量技术一Time-To-Count理论及其应用情况。论证了该新技术的理论原理,根据此原理,结合高速处理器ARM7 LPC2132,对以G-计数管为探测元件的Time-To-Count辐射测量仪进行设计。论文以实验的方法论证了Time-To-Count原理测量核辐射方法的科学性,该辐射仪的量程和精度均优于以前以脉冲计数为基础理论的MCS-51核辐射测量仪。该辐射仪具有量程宽、精度高、易操作、用户界面友好等优点。用户可以定期的对仪器的标定,来减小由于电子元件的老化对低仪器性能参数造成的影响,通过Time-To-Count测量方法的使用,可以极大拓宽G-M计数管的量程。就仪器中使用的J33型G-M计数管而言,G-M计数管厂家参考线性测量范围约为50 u R/h到5000 u R/h,而用了Time-To-Count测量方法后,结合高速微处理器ARM7 LPC2132,此核辐射测量仪的量程为20 u R/h至1R/h。在允许的误差范围内,核辐射仪的量程比以前基于MCS-51的辐射仪提高了近200倍,而且精度也比传统的脉冲计数方法要高,测量结果的线性程度也比传统的方法要好。G-M计数管的使用寿命被大大延长。 综上所述,本文取得了如下成果:对国内外Time-To-Count方法的研究现状进行分析,指出了Time-To-Count测量方法的基本原理,并对Time-T0-Count方法理论进行了分析,推导出了计数前时间和两个相邻辐射粒子时间间隔之间的关系,从数学的角度论证了Time-To-Count方法的科学性。详细说明了基于ARM 7 LPC2132的Time-To-Count辐射测量仪的硬件设计、软件编程的过程,通过高速微处理芯片LPC2132的使用,成功完成了对基于MCS-51单片机的Time-To-Count测量仪的改进。改进后的辐射仪器具有量程宽、精度高、易操作、用户界面友好等特点。本论文根据实验结果总结出了Time-To-Count技术中的几点关键因素,如:处理器的频率、计数前时间、杂质时间、采样次数和测量时间等,重点分析了杂质时间的组成以及引入杂质时间的主要因素等,对国内核辐射测量仪的研究具有一定的指导意义。

    标签: TimeToCount ARM 辐射测量仪

    上传时间: 2013-06-24

    上传用户:pinksun9

  • 深入了解数字示波器死区时间及其影响

    混合信号示波器 (MSO) 已成为 当今嵌入设备设计师的首选工具。 安捷伦科技公司 (前惠普公司) 于 1996年推出了首款MSO,并于近日 推出了第三代MSO。所有主要示波 器厂商现在都可提供混合信号示波 器。MSO在基础示波器功能中增加 了16 个或更多逻辑分析仪采集信 道,及串行总线触发和协议解码功 能,研发工程师和技术人员可更快 调试其混合信号设计。MSO可弥补 传统数字存储示波器 (DSO) 和当今 更加复杂的逻辑分析仪及串行总线 协议分析仪之间的差距。那么MSO 与传统DSO 相比,有哪些改善? 不 同厂商的MSO 之间的差别是什么?

    标签: 数字示波器 死区时间

    上传时间: 2013-04-24

    上传用户:huql11633

  • 视频差分放大器带来低电压应用的多功能性

      The LT®6552 is a specialized dual-differencing 75MHzoperational amplifier ideal for rejecting common modenoise as a video line receiver. The input pairs are designedto operate with equal but opposite large-signal differencesand provide exceptional high frequency commonmode rejection (CMRR of 65dB at 10MHz), therebyforming an extremely versatile gain block structure thatminimizes component count in most situations. The dualinput pairs are free to take on independent common modelevels, while the two voltage differentials are summedinternally to form a net input signal.

    标签: 视频 差分放大器 低电压 多功能

    上传时间: 2014-12-23

    上传用户:13691535575

  • DN1011 简单高效率隔离型反激式电源

      While simplicity and high effi ciency (for cool running) areno longer optional features in isolated power supplies, itis traditionally diffi cult to achieve both. Achieving higheffi ciency often requires the use of advanced topologiesand home-brewed secondary synchronous rectifi cationschemes once reserved only for higher power applications.This only adds to the parts count and to the designcomplexity associated with the reference and optocouplercircuits typically used to maintain isolation. Fortunately, abreakthrough IC makes it possible to achieve both high efficiency and simplicity in a synchronous fl yback topology.The LT®3825 simplifi es and improves the performance oflow voltage, high current fl yback supplies by providingprecise synchronous rectifi er timing and eliminating theneed for optocoupler feedback while maintaining excellentregulation and superior loop response.

    标签: 1011 DN 高效率 隔离型

    上传时间: 2013-10-16

    上传用户:wayne595

  • 降压升压型控制器简化手持式产品的DC/DC转换器设计

      A number of conventional solutions have been available forthe design of a DC/DC converter where the output voltageis within the input voltage range—a common scenarioin Li-Ion battery-powered applications—but none werevery attractive until now. Conventional topologies, suchas SEPIC or boost followed by buck, have numerousdisadvantages, including low effi ciency, complex magnetics,polarity inversion and/or circuit complexity/cost. TheLTC®3785 buck-boost controller yields a simple, effi cient,low parts-count, single-converter solution that is easyto implement, thus avoiding the drawbacks associatedwith traditional solutions.

    标签: DC 降压 升压型 控制器

    上传时间: 2013-10-21

    上传用户:ljt101007

  • DN460双输出降压稳压器优化效率

      The LTC3546 is a dual output current mode buck regulatorwith fl exible output current partitioning. Beyondthe advantages normally associated with dual outputregulators (reduced size, cost, EMI and part count, withimproved effi ciency), the LTC3546’s outputs can bepartitioned for either 3A and 1A outputs, or two 2A outputs.This increases its application range and simplifi esmultiple supply rail designs. A confi gurable Burst Mode®clamp for each output sets the current transition levelbetween Burst Mode operation and forced continuousconduction mode to optimize effi ciency over the entireoutput range. An adjustable switching frequency up to4MHz and internal power MOSFET switches allow forsmall and compact footprints.

    标签: 460 DN 输出 优化效率

    上传时间: 2013-11-04

    上传用户:yxgi5