C语言编程学习课件 (9).pdf
《C语言编程学习课件 (9).pdf》由会员分享,可在线阅读,更多相关《C语言编程学习课件 (9).pdf(14页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Programming In CProgramming In C Programming In CProgramming In C A huge tree that fills ones arms grows from a tiny seedling;a nine-storied tower rises from a heap of earth.-Lao Tzu(the founder of the Taoist)Programming In CProgramming In C C programs can be composed of multiple functions Program#i
2、nclude stdio.h#define PI 3.14159 float CalcArea(float r);void main()float r,area;scanf(%f,&r);area=CalcArea(r);printf(Area=%f,area);float CalcArea(float r)float a;if(r=0)a=0;else a=PI*r*r;return(a);A function consists of a series of statements The statement performs a specific operation C statements
3、-declarations/The C90 standard#include stdio.h#define PI 3.14159 float CalcArea(float r);void main()float r,area;scanf(%f,&r);area=CalcArea(r);printf(Area=%f,area);float CalcArea(float r)float a;if(r=0)a=0;else a=PI*r*r;return(a);/The C99 standard void main()char ch;printf(Enter Age);int age;scanf(%
4、d,&age);printf(%c,%dn,ch,age);void main()float r,area;scanf(%f,&r);area=CalcArea(r);printf(Area=%f,area);C statements-expression statement An expression statement is formed by adding a semicolon after the expression.C statements-control statement The statements used to control and change the executi
5、on flow of a program are called control statements.float CalcArea(float r)float a;if(r=0)a=0;else a=PI*r*r;return(a);C statements-compound statement In control statements,there are usually multiple statements executed after a certain condition is met.They are either all executed or not,logically for
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C语言编程学习课件 9 语言 编程 学习 课件
限制150内