- 3
- 0
- 约9.51千字
- 约 43页
- 2017-03-03 发布于湖北
- 举报
C语言程序设计_第4章函数与编译预处理讲述
北京科技大学 计算机系 第4章 函数与编译预处理 第4章 函数与编译预处理 4.1 函数概述 【例】 #include stdio.h void print_line() /*函数定义*/ { printf(*********************************\n);} void print_text() /*函数定义*/ { printf( Welcome to Beijing \n);} void main() {print_line(); /*函数调用*/ print_text(); /*函数调用*/ print_line(); /*函数调用*/ } ⑷ 函数的种类 由C编译系统定义的一种函数,存放在系统函数库中,用户可以根据需要随时调用 常用函数 如:fabs、sqrt、sin、pow、rand (常用数学函数参见教材P100 表4-1和附录B ) 函数调用形式: 函数名([参数表]) 例如: sqrt(x) 例 #include math.h #include stdio.h void main( ) { float x=4.5; printf (%f, %f, %f\n ,sqrt(x),pow(x,2),fabs(-x)); } 4.2.1 函
原创力文档

文档评论(0)