C语言编程学习课件 (37).pdf
《C语言编程学习课件 (37).pdf》由会员分享,可在线阅读,更多相关《C语言编程学习课件 (37).pdf(7页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Programming In CProgramming In C Programming In CProgramming In C Nested calls of functions Function call is similar to entrust someone to complete a task,and such entrust allows for delivery.For example,A entrusts B to do something,and B entrusts C to do it.This is a nested call relationship.main()
2、function call for function A end Nested call procedure diagram:function A call for function B function B Nested calls of system functions the process of nested call to system functions,is a common form of learning in the past.#include stdio.h#include math.h /import the math library main()/main()func
3、tion double x,y,z;scanf(%lf,&x);y=x;z=x*exp(-pow(x,2)-pow(y,2);printf(z=%lfn,z);result 0.8,-0.2 example:Nested calls of system functions 0.405294 double exp(double x)double pow(double x,double y)xe(-x2-y2)When writing a user-defined function,it is more efficient to directly call the system functions
4、 if they involve the calculation functions provided by the system functions.For example,write a program to solve k=x*sin(x)1.only one parameter is required in the design of user-defined functions.Compile function cal(x)to calculate x*sin(x).2.the nested call of the system function sin(x)is used to c
5、alculate the sine function,thereby completing the entire calculation.Example:solve k=x*sin(x)#include stdio.h#include math.h double cal(double x)/solving function return x*sin(x);main()/main()function double k,x;scanf(%lf,&x);k=cal(x);printf(k=%lfn,k);The user-defined function calls the system funct
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C语言编程学习课件 37 语言 编程 学习 课件 37
限制150内