您的位置:首页 > 其它

递归判断是否是递增数组

2010-10-16 20:14 281 查看
// recursiveIncr.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int isIncr(int *a,int len){
if(len==2)
return *a<*(a+1);
if(*a<*(a+1)){
return isIncr(a+1,len-1);
}
return 0;
}
int main(int argc, char* argv[])
{
int a[] = { 1, 3, 4, 5, 6, 7, 8, 9};
printf("%d/n",isIncr(a,sizeof(a)/sizeof(*a)));
return 0;
}


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐