/*
// 1. 无参无返回值void hello() { printf("hello world!\n"); }// 2. 无参有返回值int peoplweCount(){ return 10; }// 3. 有参有返回值int max(int a, int b) { return a > b ? a : b; }// 4. 有参无返回值(打印一个数)void number(int a) { printf("%d\n",a); }//1、编写函数int sumValue(int m,int n):计算m到n的和。int sumValue(int m,int n) { int sum = 0; for (int i = m; i <= n ; i ++) { sum += i; } return sum; }//编写函数dayOfYear(year, mouth,day),使得函数返回由这三个参 数确定的那⼀一天是⼀一年中的第⼏几天。 */void dayofYear(int year, int month, int day);//函数的声明void dayofYear(int year, int month, int day)//函数的定义{ int yearrun = 0; if (year%400 == 0 || (0 == year % 4 && 0 != year %100)) { yearrun = 1; } int dayCount = 0; switch (month - 1) { case 11: dayCount += 30; case 10: dayCount += 31; case 9: dayCount += 30; case 8: dayCount += 31; case 7: dayCount += 31; case 6: dayCount += 30; case 5: dayCount += 31; case 4: dayCount += 30; case 3: dayCount += 31; case 2: dayCount += 28 + yearrun; case 1: dayCount += 31; case 0: dayCount += day; default: break; }printf("%d",dayCount);}/*//3、编写函数,返回三个整数的中间数。*/int main(int argc, const char * argv[]) { #pragma mark ------函数的定义------/* 函数: 具有特定功能的代码段 1 . 库函数 //系统提供好的函数 2. 自定义函数 //开发者自己写的函数 // 1. 无参无返回值 for (int i = 0; i < 10; i ++) { hello(); } // 2. 无参有返回值// 一个人有俩只手,定义变量 r = 2; int r = 2; int hands = r * peoplweCount(); printf("%d\n",hands);// 3. 有参有返回值 int a = max(20,30); printf("%d\n",a);// 4. 有参无返回值(打印一个数) number(4); int a = sumValue(10,20); printf("%d\n",a); */ dayofYear(2014, 3, 1); printf("\n");/* int a , b; scanf("%d%d",&a,&b); printf("%d\n",add(a,b)); printf("%d\n",dev(a,b)); printf("%d\n",nul(a,b)); float c = divi(a, b); printf("%.2f\n",c);// 形参的改变不会改变实参的值,形参只拷贝了实参的副本//对其进行操作,实参不会改变,形参则会改变 // 交换不成,因为只是拷贝,是不会改变的//和普通元素作为变量没有区别 int a[5] = {1,2,3,4,5};// swap(a[1],a[3]);// for (int i =0; i < 5; i ++) { // // printf("%d ",a[i]);// } changeArray(a); long s = 0,n = 0; int x = 0; for (int i = 1;i <= 3; i ++) { x = pingfang(i); n = jiecheng(x); s = s + n; } printf("%ld",s);*/ // printf("%ld ",jiecheng2(5));