所属分类:
VC书籍
开发工具:Visual C++
文件大小:127KB
下载次数:20
上传日期:2005-06-14 17:51:25
说明: C++完美演绎 经典算法 如 /* 头文件:my_Include.h */ #include <stdio.h> /* 展开C语言的内建函数指令 */ #define PI 3.1415926 /* 宏常量,在稍后章节再详解 */ #define circle(radius) (PI*radius*radius) /* 宏函数,圆的面积 */ /* 将比较数值大小的函数写在自编include文件内 */ int show_big_or_small (int a,int b,int c) { int tmp if (a>b) { tmp = a a = b b = tmp } if (b>c) { tmp = b b = c c = tmp } if (a>b) { tmp = a a = b b = tmp } printf("由小至大排序之后的结果:%d %d %d\n", a, b, c) } 程序执行结果: 由小至大排序之后的结果:1 2 3 可将内建函数的include文件展开在自编的include文件中 圆圈的面积是=201.0619264
(C perfect interpretation of classic algorithms/* header files : my_Include.h* /# include lt; Stdio.hgt;/* Start with the built-in C language function instructions* /# define PI 3.1415926/* Acer constants later, in another chapter Elaborates on* /# define circle (radius) (PI** radius radius)/* Macro function, a round of the area*//* to compare the numerical size of the write functions include writing paper*/int show_big_or_small (int a, b int, int c) (int tmp if (Agt; b) (tmp = a b a = b = tmp) if (BGT; c) (tmp = b b = c c = tmp) if (Agt; b) ( tmp = a b a = b = tmp) printf ( "ascending order by the following results :% d% d% d \ n", a, b, c)) procedures : in ascending order by the following results : 1 2 3 will the built-in functions include documents writte)