欢迎光临!

随笔分类 -  第六章 函数

摘要:#define _CRT_SECURE_NO_WARNINGS#include<stdio.h> //函数自己调用自己就是递归(试用:上N个楼梯有几种上法,只能走一步或二步)int step(int n){if (1 == n||2==n){return n;//第二步一定写结束条件}return 阅读全文
posted @ 2022-08-11 18:05 国师编程 阅读(93) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h>//函数格式:[返回值类型]函数名(形式参数表列){函数体;}void hello()//自定义函数,void表示函数体没有返回值{printf("欢迎回来!\n"); //函数体}void main()//主函数{hello();//调用hello()函数} #i 阅读全文
posted @ 2022-08-11 17:58 国师编程 阅读(69) 评论(0) 推荐(0) 编辑
摘要:#include"func.h" //printstar函数定义,就是函数实现int printstar(int i)//i即为形式参数,也就是形参{printf("*************\n");printf("printstar %d\n", i);return i + 3;}//print 阅读全文
posted @ 2022-08-11 17:11 国师编程 阅读(159) 评论(0) 推荐(0) 编辑
摘要:#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#define PI 3.1416 double circu(double r)//函数定义,形参{return 2 * PI * r;}int main() //主函数{double mr, mc; 阅读全文
posted @ 2022-08-11 17:04 国师编程 阅读(52) 评论(0) 推荐(0) 编辑

欢迎光临!!
点击右上角即可分享
微信分享提示