摘要:
递归——二次查找 #include<stdio.h>int b[10]={1,1,2,3,3,5,6,6,7,9},a;{ int o; if(x>y) return 0; //进行判断是否是在范围 else { o=(x+y)/2; if(b[o]==a) return o; if(a<b[o]) 阅读全文
摘要:
我对编程的兴趣越来越大,今天下午我们学了函数递归: 汉诺塔: #include<stdio.h> void hanio(int n,char A,char B,char C) { if(n==1) printf("%c->%c\n",A,C); else { hanio(n-1,A,C,B); pr 阅读全文
摘要:
夏日的成都还在下淅淅沥沥的小雨,我们的心却万里晴空。今天我们学了自定义函数(子函数),成果如下: 三数最小值 #include<stdio.h>int tin(int x,int y){ int z; if(x<y)z=x; else z=y; return z;}int main(){ int a 阅读全文