Location:
Search - 2.4.20-8
Search list
Description: 第1章 文件结构... 11 1.1 版权和版本的声明... 11 1.2 头文件的结构... 12 1.3 定义文件的结构... 13 1.4 头文件的作用... 13 1.5 目录结构... 14 第2章 程序的版式... 15 2.1 空行... 15 2.2 代码行... 16 2.3 代码行内的空格... 17 2.4 对齐... 18 2.5 长行拆分... 19 2.6 修饰符的位置... 19 2.7 注释... 20 2.8 类的版式... 21 第3章 命名规则... 22 3.1 共性规则... 22 3.2 简单的Windows应用程序命名规则... 23 3.3 简单的Unix应用程序命名规则... 25 第4章 表达式和基本语句... 26 4.1 运算符的优先级... 26 4.2 复合表达式... 27 4.3 if 语句... 27 4.4 循环语句的效率... 29 4.5 for 语句的循环控制变量... 30 4.6 switch语句... 30 4.7 goto语句... 31 第5章 常量... 33 5.1 为什么需要常量... 33 5.2 const 与 #define的比较... 33 5.3 常量定义规则... 33 5.4 类中的常量... 34 第6章 函数设计... 36 6.1 参数的规则... 36 6.2 返回值的规则... 37 6.3 函数内部实现的规则... 39 6.4 其它建议... 40 6.5 使用断言... 41 6.6 引用与指针的比较... 42 第7章 内存管理... 44 7.1内存分配方式... 44 7.2常见的内存错误及其对策... 44 7.3指针与数组的对比... 45 7.4指针参数是如何传递内存的?... 47 7.5 free和delete把指针怎么啦?... 50 7.6 动态内存会被自动释放吗?... 50 7.7 杜绝“野指针”... 51 7.8 有了malloc/free为什么还要new/delete ?... 52 7.9 内存耗尽怎么办?... 53 7.10 malloc/free 的使用要点... 54 7.11 new/delete 的使用要点... 55 7.12 一些心得体会... 56 第8章 C++函数的高级特性... 57 8.1 函数重载的概念... 57 8.2 成员函数的重载、覆盖与隐藏... 60 8.3 参数的缺省值... 63 8.4 运算符重载... 64 8.5 函数内联... 65 8.6 一些心得体会... 68 第9章 类的构造函数、析构函数与赋值函数... 69 9.1 构造函数与析构函数的起源... 69 9.2 构造函数的初始化表... 70 9.3 构造和析构的次序... 72 9.4 示例:类String的构造函数与析构函数... 72 9.5 不要轻视拷贝构造函数与赋值函数... 73 9.6 示例:类String的拷贝构造函数与赋值函数... 73 9.7 偷懒的办法处理拷贝构造函数与赋值函数... 75 9.8 如何在派生类中实现类的基本函数... 75 9.9 一些心得体会... 77 第10章 类的继承与组合... 78 10.1 继承... 78 10.2 组合... 80 第11章 其它编程经验... 82 11.1 使用const提高函数的健壮性... 82 11.2 提高程序的效率... 84 11.3 一些有益的建议
Platform: |
Size: 84427 |
Author: 87503655@qq.com |
Hits:
Description: 编号为1,2,…,n的n个人按顺时针方向围坐一圈,每人持有一个密码(正整数),一开始人选一个正整数作为报数上限m,从第一个人开始按顺时针方向从自1开始顺序报数,报道m时停止报数。报m的人出列,将他的密码作为新的m值,从他的顺时针方向上的下一个人开始重新从1报数,如此下去,直至所有人全部出列为止,设计一个程序求出出列顺序。采用单向循环链表模拟此过程,按照出列的顺序印出各人的编号测试数据:m的初值为20;n=7,7个人的密码依次为:3,1,7,2,4,8,4,首先m的值为6(正确的出列顺序应为6,1,4,7,2,3,5)-No. 1, 2, ..., n n clockwise direction by individuals sitting around a circle, each holding a password (positive integers), a candidate started as a positive integers m ceiling on the number of reported from the first individuals to embark on the clockwise direction from the start sequence from a few newspaper reports m reportedly stopped a few. M reported out of the list of his password as a new value m, from the clockwise direction on the next re-started from a few reported so on, until all out all out, the design of a procedure sought out the order out. Listless one-cycle simulation process and follow the sequence shown in the numbers printed each test data : m for the initial 20; N = 7,7 personal passwords were : 3,1,7,2,4,8,4, first the value of m 6 (right to be out of order out 6,1,4
Platform: |
Size: 1024 |
Author: 弄月 |
Hits:
Description: 这是我自已写的HD44780 LCD1602液晶屏的程序,是基于AVR单片机上实现的。
/**************************************************************************************************
* 简介
*
* 本模块仅使用于字符显示液晶模块
*
* 当前版本的驱动仅支持以下类型LCD模块驱动:
* Hitachi HD44780 或与之兼容的芯片.
*
* LCD显示函数支持以下格式:
* 1 line x 16 characters 2 lines x 16 characters 4 lines x 16 characters
* 1 line x 20 characters 2 lines x 20 characters 4 lines x 20 characters
* 1 line x 24 characters 2 lines x 24 characters
* 1 line x 40 characters 2 lines x 40 characters
*说明:
* 1 line x 16 characters 需要定义为2*8的液晶模块
*
* 不支持外部内存模式
**************************************************************************************************/
-This is my own written HD44780 LCD1602 LCD procedure is based on the AVR Single Chip achievable. /*************************************************************************************************** Introduction** This module uses only the characters displayed in the LCD module** the current version of the driver only supports the following types of LCD driver module:* Hitachi HD44780 chip or compatible .** LCD display function supports the following format:* 1 line x 16 characters 2 lines x 16 characters 4 lines x 16 characters* 1 line x 20 characters 2 lines x 20 characters 4 lines x 20 characters* 1 line x 24 characters 2 lines x 24 characters* 1 line x 40 characters 2 lines x 40 characters* Note:* 1 line x 16 characters need to define 2*** 8 LCD modules do not support external memory mode**************************************************************************************************/
Platform: |
Size: 6144 |
Author: 谢志俊 |
Hits:
Description: UCOS移植到LPC2148上使用:有6个简单任务:
功能:
任务0 (P1.8 灯循环 亮 灭 )
任务1 (P1.9 灯循环 亮 灭 )
任务2 (P1.20 灯循环 亮 灭 )
任务3 (P0.7 蜂鸣器循环 鸣 停 )
任务4 (595驱动的数码管从0~9 循环显示)
任务5 (P1.21-P1.25LED灯 循环亮 灭)
QQ:228939191 月亮-UCOS LPC2148 transplanted to use: There are six simple tasks: feature: Task 0 (P1.8 cycle bright lights out) Missions 1 (P1.9 cycle bright lights out) Missions 2 (P1.20 cycle bright lights out) Missions 3 (P0.7 buzzer alarms to stop the cycle) Missions 4 (595-driven digital control from 0 ~ 9 cycle display) Missions 5 (P1.21-P1.25LED out bright light cycle) QQ: 228939191 moon
Platform: |
Size: 325632 |
Author: 月亮 |
Hits:
Description: 一 :排序n个元素,元素为随机生成的长为1~16的字符串,n的取值为2k(k取4、6、8、10、12、16、18、20),排序算法分别为直接插入排序, 冒泡排序,堆排序,归并排序,快速排序,比较各种排序在不同输入下的运行时间.
二:排序n个元素,元素为随机生成的1~10000的正整数,n的取值为2k(k取4、6、8、10、12、16、18、20),排序算法分别为直接插入排序,快速排序,基数排序,计数排序,比较各种排序在不同输入下的运行时间.-1: sort n elements, element for a length of randomly generated 1 ~ 16 of the string, n value for 2k (k check 4,6,8,10,12,16,18,20), sorting algorithms, respectively, for direct insertion sort, bubble sort, heap sort, merge sort, quick sort, compare different sort of run-time input. b: to sort n elements, element for the randomly generated one ~ 10000 positive integer, n value for 2k (k check 4,6,8,10,12,16,18,20), sorting algorithms, respectively, for direct insertion sort, Quick Sort, Radix Sort, Counting Sort, compare, under different input in order the running time.
Platform: |
Size: 3072 |
Author: mhb |
Hits:
Description: ucos移植使用-6个简单任务功能:
Task0 任务0 (P1.8 灯循环 亮 灭 )
Task1 任务1 (P1.9 灯循环 亮 灭 )
Task2 任务2 (P1.20 灯循环 亮 灭 )
Task3 任务3 (P0.7 蜂鸣器循环 鸣 停 )
Task4 任务4 (595驱动的数码管从0~9 循环显示)
Task5 任务5 (P1.21-P1.25LED灯 循环亮 灭)
--6 uCOS transplantation using a simple task function: Task0 task 0 (P1.8 cycle bright lights out) Task1 task 1 (P1.9 cycle bright lights out) Task2 task 2 (P1.20 cycle bright lights out) Task3 task 3 ( P0.7 buzzer alarms to stop the cycle) Task4 task 4 (595-driven digital control from 0 ~ 9 cycle) Task5 task 5 (P1.21-P1.25LED cycle bright lights out)
Platform: |
Size: 327680 |
Author: 月亮 |
Hits:
Description: 约瑟夫环问题
以7个人为例,用链表实现,每个人都有自己的密码,当他出列时,以他的密码作为下一个的个数,例这七个人的密码分别是3,1,7,2,4,8,4。第一个执行的个数是20
-Joseph Central to 7 personal problems as an example, use list realize that everyone has their own password, when he was out of time, with his password as the next number, for example, the password for these seven individuals were 3,1 , 7,2,4,8,4. The first implementation of the number is 20
Platform: |
Size: 1024 |
Author: 张 |
Hits:
Description: 打印如下规律的螺旋矩阵,尽管存在求数值规律的方法,但本代码的方法更为基本和通用。vc++ 2005环境。
1 2 9 10 25
4 3 8 11 24
5 6 7 12 23
16 15 14 13 22
17 18 19 20 21 -Print the following laws of the spiral matrix, despite the existence of the law for numerical methods, but this code is more basic and common methods. vc++ 2005 environment. 1 2 9 10 254 3 8 11 245 6 7 12 2316 15 14 13 2217 18 19 20 21
Platform: |
Size: 3072 |
Author: inspire |
Hits:
Description: 相关知识:通过n+1个节点的次数不超过n的Lagrange插值多项式为:
其中,Lagrange插值基函数 ,k=0,1,…,n。
实验用例: 已知函数y=f(x)的一张表:
x 0 10 20 30 40 50 60 70 80 90 100 110 120
y 5 1 7.5 3 4.5 8.8 15.5 6.5 -5 -10 -2 4.5 7
试验要求:利用Lagrange插值多项式 求被插值函数f(x)在点x=65处的近似值。建议:画出Lagrange插值多项式 的曲线。
-Related knowledge: By n+ 1 the number of nodes does not exceed the Lagrange interpolation polynomial n as follows: one, Lagrange interpolation basis function, k = 0,1, ..., n. Experimental use case: a known function y = f (x) of a table: x 0 10 20 30 40 50 60 70 80 90 100 110 120y 5 1 7.5 3 4.5 8.8 15.5 6.5-5-10-2 4.5 7 test requirements: for the use of Lagrange interpolation polynomial interpolation function was f (x) at the point x = 65 Department approximation. Recommendations: Lagrange interpolation polynomial to draw the curve.
Platform: |
Size: 1024 |
Author: 张涛 |
Hits:
Description: 设计求解约瑟夫环问题的出列顺序。具体的要求和说明如下:
(1)利用单向循环链表存储结构模拟此过程,按照出列的顺序输出个人的编号。
(2)m的初值为20;n=7,7个人的密码依次为:3,1,7,2,4,8,4,首先m的值为6(正确的出列顺序应为:6,1,4,7,2,3,5)。
(3)程序运行后,首先要求用户指定初始报数的上限值,然后读取个人的密码。可设n<=30,此题所用的循环链表中不需要“头结点”,请注意空表和非空表的界限。
(4)将上述功能改为在顺序结构上实现。-#include<stdio.h>
#include<stdlib.h>
#define MAX_NODE_NUM 30
#define TRUE 1U
#define FALSE 0U
typedef struct NodeType
{ int id /*
Platform: |
Size: 2048 |
Author: chen |
Hits:
Description: 问题描述:编号为1,2,……,n的n个人顺时针方向围坐一圈,每人持有一个密码(正整数)
一开始任选一个整数作为报数上限值m,从第一个人开始顺时针自1开始顺序报数,报到m时停止报数。
报m的人出列,将他的密码座位新的m值,从他在顺时针方向上的下一个人开始重新从1报数
如此下去,知道所有的人都出列为止。
例如:m的初值为20,n=7,7个人的密码依次是:3,1,7,2,4,8,4
出列的顺序为 6,1,4,7,2,3,5-Problem Description: numbered 1,2, ... ..., n n-clockwise around a circle of individuals, each holder of a password (positive integer) the beginning of either an integer number as the upper limit at m, from the first clockwise from 1 person to start off the beginning of the order, appearance, stopped at a few m. Those who reported m out of his seat a new password m value, in a clockwise direction from the next person to start off again from the 1 like that, know that all out of date. For example: m for the initial 20, n = 7,7 personal password are: 3,1,7,2,4,8,4 out the order for the 6,1,4,7,2,3, 5
Platform: |
Size: 1024 |
Author: mao |
Hits:
Description: 可以实现数据的2到20次平滑,比如原来数据
是11,7,8,1,15,7,17,10运行二次平滑后变成11,9,8,4,9,8,9.-this program can finish the data shift from 2 to 20 ,for example:the old number11,7,8,1,15,7,17,10 go on with 2 times shift,the new number is11,9,8,4,9,8,9.
Platform: |
Size: 9216 |
Author: aisher |
Hits:
Description: 打印如下形式的矩阵;
n=5:
1 2 9 10 25
4 3 8 11 24
5 6 7 12 23
16 15 14 13 22
17 18 19 20 21
n=6:
1 2 9 10 25 26
4 3 8 11 24 27
5 6 7 12 23 28
16 15 14 13 22 29
17 18 19 20 21 30
36 35 34 33 32 31
看看1,2,3,4,5,6,7的序列。则可以看出,他们的排列几乎是一个回形。-Print the following form of matrix n = 5: 1 2 9 10 25 4 3 8 11 24 5 6 7 12 23 16 15 14 13 22 17 18 19 20 21 n = 6: 1 2 9 10 25 26 4 3 8 11 24 27 5 6 7 12 23 28 16 15 14 13 22 29 17 18 19 20 21 30 36 35 34 33 32 31 look at the sequence 1,2,3,4,5,6,7. You can see, they are arranged in almost a return to form.
Platform: |
Size: 1024 |
Author: ttzz |
Hits:
Description: 三星S3C2440的 LINUX内核2.4.20-Samsung S3C2440 the LINUX kernel 2.4.20
Platform: |
Size: 36329472 |
Author: jiang |
Hits:
Description: 10个人围成一个环,分东西。他们一开始有{10,2,8,22,16,4,10,6,14,20}
个东西,所有的人如果是奇数个就再要一个,然后所有的人同时将自己的一半给他右边的人,
问几次后大家的东西的个数一样-10 people surrounded by a ring divided into East and West. They began to have (1) 10,2,8,22,16,4,10,6,14,20 a thing, all of them if it is an odd one would no longer be one, and then all the people at the same time his own half to the his right of people, and asked a few times the number of things we like
Platform: |
Size: 2048 |
Author: shark |
Hits:
Description: msp430的时钟设定API程序,包括XT2的开关,DCO的设定和MCLK及SMCLK的时钟源选择,从此不用记寄存器
void XT2_on()
void XT2_off()
void DCOset(BYTE freq) //1,2,4,8,10,12,14,15,16,20,32
void Msource(char source) //enum:ACLK,XT2,DCO
void SMsource(char source) //enum:XT2,DCO-msp430‘s clock settings API procedures, including the XT2 switch, DCO and SMCLK set and MCLK clock source selection, from not remember register void XT2_on () void XT2_off () void DCOset (BYTE freq) // 1 , 2,4,8,10,12,14,15,16,20,32 void Msource (char source) // enum: ACLK, XT2, DCO void SMsource (char source) // enum: XT2, DCO
Platform: |
Size: 2048 |
Author: 水果糖 |
Hits:
Description: 约瑟夫问题(c语言)
有1至 N编号的N 个人按顺时针方向围坐一圈,每人持有一个密码(正整数),一开始以正整数m作为报数上限值,从第一个人开始顺时针方向自1开始顺序报数,报到m时停止报数,报m的人出列,将他的密码作为新的报数上限值,从他的顺时针方向上的下一个人开始重新报数,如此下去,直至所有的人全部出列为止,要求产生记录出列顺序的表。如N = 7,每个人的密码依次是:3,1,7,2,4,8,4,m的值为20,则出列顺序为6,1,4,7,2,3,5。所有人用一个循环单链表表示,表中每个结点代表一个人,按出列次序依次将结点从循环单链表中删除,并按顺序存放在一个单链表中,链表的每个结点包括三个字段:code代表密码,no代表人的编号,link是指向下一个结点的指针。在主函数中,用堆分配的方法建立Josephus对象。循环展开对问题的求解。-josephy question
Platform: |
Size: 1024 |
Author: taopen |
Hits:
Description: 语音CELP压缩解压源代码(C语音)- Pronunciation CELP compression decompression source code (C pronunciation) -
* 4800 bps CELP Characteristics
*
* Spectrum Pitch Code Book
* ------------- --------------- -----------------
* Update 30 ms 30/4 = 7.5 ms 30/4 = 7.5 ms
* ll=240 lp=60 l=60
*
* Order 10 256 (max) x 60 512 (max) x 60
* 1 gain 1 gain
*
* Analysis Open loop Closed loop Closed loop
* Correlation Modified MSPE MSPE VQ
* 30 ms Hamming VQ, weight=0.8 weight=0.8
* no preemphasis range 20 to 147 shift by 2
* 15 Hz BW exp (w/ fractions) 77 sparsity
*
* Bits per 34 indep LSP index: 8+6+8+6 index: 9*4
* Frame [3444433333] gain(-1,2): 5*4 gain(+/-): 5*4
*
* Bit Rate 1133.3 bps 1600 bps 1866.67 bps
*
* NOTE: The remaining 200 bps are used as follows: 1 bit per frame
* for synchronizatio
Platform: |
Size: 109568 |
Author: lcd |
Hits:
Description: 得到如下样式的二维数组
*zigzag数组(JPEG编码取像素数据的排列顺序)
* 0, 1, 5, 6,14,15,27,28,
* 2, 4, 7,13,16,2 9,42,
* 3, 8,12,17,25,30,41,43,
* 9,11,18,24,31,40,44,53,
* 10,19,23,32,39,45,52,54,
* 20,22,33,38,46,51,55,60,
* 21,34,37,47,50,56,59,61,
* 35,36,48,49,57,58,62,63.-Get the following style of two-dimensional array
The*zigzag array (JPEG coding pixel data sequence)
*
* 0, 1, 5, 6,14,15,27,28,
* 2, 4, 7,13,16,26,29,42,
* 3, 8,12,17,25,30,41,43,
* 9,11,18,24,31,40,44,53,
* 10,19,23,32,39,45,52,54,
* 20,22,33,38,46,51,55,60,
* 21,34,37,47,50,56,59,61,
* 35,36,48,49,57,58,62,63.
Platform: |
Size: 1024 |
Author: Zhang X |
Hits:
Description: (1)顺序存储结构的实现。
列如,已知:
f(x)=8x^6+5x^5-10x^4+32x^2-x+10,g(x)=7x^5+10x^4-20x^3-10x^2+x,
求和结果:f(x)+g(x)=8x^6+12x^5-20x^3+22x^2+10。
顺序表数据类型定义如下:
#define MAXLEN 100
typedef struct
{ int data[MAXLEN]
int last
}SeqList
(2)链式存储结构的实现
列如,已知:
f(x)=100x^100+5x^50-30x^10+10,g(x)=150x^90-5x^50+40x^20+20x^10+3x,
求和结果:f(x)+g(x)=100x^100+150x^90+40x^20-10x^10+3x+10。
(3)编程实现多项式求和的运算。
-(1) the realization of the sequential storage structure.
Such as, known:
F (x) = 8 x ^ ^ 6+ 5 x 5-10 x ^ 4+ x ^ 2-32 x+ 10, g (x) = 7 x ^ ^ 5+ 10 x 4-20 x ^ 3-10 x ^ 2+ x,
Sum the results: f (x)+ g (x) = 8 x ^ ^ 6+ 12 x 5 20 x ^ 3+ x ^ 2+ 10.
The order table data types are defined as follows:
# define MAXLEN. 100
Typedef struct
{int data [MAXLEN]
Int last
} SeqList
(2) the implementation of the chain store structure
Such as, known:
F (x) = 100 100+ 5 x x ^ ^- 30 x ^ 10+ 10, 50 g (x) = 150, 90-5 x x ^ ^ 50+ 20+ 20 x 40 x ^ ^ 10+ 3 x.
Sum the results: f (x)+ g (x) = 100+ 150 x 100 x ^ ^ 90+ x ^ 20-40 x 10 ^ 10+ 3+ 10 x.
(3) polynomial summation calculations by programming.
Platform: |
Size: 1024 |
Author: 金珠燕 |
Hits:
« 12
3
4
5
6
7
8
9
10
...
25
»