- 1、本文档共36页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
switch(month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (day 31 || day 1) printf(\nYou have entered an invalid day!); break; case 2: if ( (year % 4 == 0 year % 100 != 0) || (year % 400 == 0) ) //is a leap year { if (day 29 || day 1) printf(\nYou have entered an invalid day!); } else // is not a leap year if (day 28 || day 1) printf(\nYou have entered an invalid day!); break; case 4: case 6: case 9: case 11: if (day 30 || day 1) printf(\nYou have entered an invalid day!); break; } Read an integer: Input a string consists of digit Convert the string into an integer when accept a ‘\n’ Report an error if other characters are detected Read an integer: #includestdio.h #includemath.h main() { int i=0,x=0;char b; printf(Please enter an integer); do {b=getchar(); x=pow(10,i)*b+x;i++;} while (b=1b=9); printf(%d,x); return 0; } Today’s Objectives introduction Function: definition, declaration and call Parameters and return value Program with functions Standard Library Functions What is a Function? Function in math: y=f(x); y=sin(x); y=(a*b); In Early computer program: macro; routine; subroutine; procedure; A small machine that transforms the data it receives into a finished product (x1,x2,…,xn) function ? y Function: definition; declaration and call Function declaration: Define the prototype of a function Function Definition : write a function name, parameter list, a set of instructions Calling a function: set the value of parameters and execute the function. Return and continue the original executing afterwards. Function prototypes The declaration statement for a function is referred to as a function prototype Declare the name of a function Declares the data type of the value that will be directly returned by the func
您可能关注的文档
- 包头师范学院区域分析与规划课件第八章第二节 发展方向与战略目标.ppt
- 包头师范学院区域分析与规划课件第八章第一节 战略与区域发展战略.ppt
- 包头师范学院区域分析与规划课件第七章第三节 区域规划的由来与发展.ppt
- 包头师范学院区域分析与规划课件第七章第四节 区域规划的方法和程序.ppt
- 包头师范学院区域分析与规划课件第七章第一节 区域规划的概念及内容.ppt
- 包头师范学院区域分析与规划课件第十章 区域管治.ppt
- 包头师范学院人力资源管理课件第3章 人力资源管理者和人力资源管理部门.ppt
- 包头师范学院数据库原理与应用课件 第五章.ppt
- 包头师范学院数学教学论课件 绪论.ppt
- 包头师范学院数学教学论课件第八章 中学数学教育测量和评价.ppt
- 2025年全国爱国卫生月活动总结(28篇).docx
- 2025年公交驾驶员年终总结(6篇).docx
- 2025年公司年度行政工作计划(31篇).docx
- 知到智慧树网课:C语言编程新思路(山东理工大学)章节测试满分答案.pdf
- 《毛泽东思想和中国特色社会主义理论体系概论》专题测试参考答案.docx
- 知到智慧树网课:C语言编程方法与思想(北京航空航天大学)章节测试满分答案.docx
- 知到智慧树网课:大学英语课程思政(哈工)章节测试满分答案.docx
- 2025年二级建造师法规章节精编习题库.pdf
- 2025年二级建造师法规章节精编习题库.doc
- 2025年北京市三类人员安全员c3证考试题库及答案.doc
最近下载
- 2025年浙江广厦建设职业技术大学单招职业适应性测试题库完整.docx VIP
- 15 《青春之光》(课件)统编版语文七年级下册.pptx VIP
- 2024电化学储能电站典型设计图.pdf(1).doc
- 计算机类单招复习题及答案.docx VIP
- 纪检业务知识培训课件.pptx
- 4122 使用权资产底稿编制-oo.xlsx
- 项目经理部生产区、生活区、办公区建设标准 .docx VIP
- 2025年浙江广厦建设职业技术大学单招职业适应性测试题库有答案.docx VIP
- 2019教科版五年级科学下册《绿豆苗的生长》教案教学设计.docx
- IPC-TM-650-CN中文 -2023——测试方法扫描版.pdf
文档评论(0)