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
標簽:
my_INclude
INclude
define
3.141
上傳時間:
2014-01-17
上傳用戶:epson850