摘要: #include using namespace std;void matching(int a[],int b[],int N){ int i=0; while(i<N) { int j=0; while(j<N) { if(a[i]==b[j]) { cout<<"a["<<i<<"]"<<match<<"b["<<j<<"]"<<endl;break;} j++; } i++;} cout<< 阅读全文
posted @ 2013-10-22 01:03 编程的爬行者 阅读(180) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;int mystrlen(*buf, int N){ if(buf[0]==0||N==0) return 0; else if(N==1) return 1; int t=mystrlen(buf,N/2);//折半长度递归 if(t>N; TN=mystrlen(buf,N);//为什么输入参数直接是buf,因为buf是字符数组,本身就是地址,传递给形参*buf cout<<"TN="<<TN<<endl; system("pause"); retur 阅读全文
posted @ 2013-10-21 22:36 编程的爬行者 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 递归求N!#include using namespace std;int fac(int i){ int n,val; for(n=i;n>1;n--)val*=n; return val;}int main(){ int i; cout>i; f=fac(i); cout<<"i!="<<f<<endl; reurn 0;} 阅读全文
posted @ 2013-10-21 21:48 编程的爬行者 阅读(94) 评论(0) 推荐(0) 编辑