![](https://img-blog.csdnimg.cn/2022010619400268365.png)
题目
解决代码及点评
/*
判断是不是升序序列,通过递归即可
*/
#include <iostream>
using namespace std;
bool go(int *array, int n)
{
if (n == 4)
{
cout << "是递增";
return true;
}
if (array[n] <= array[n + 1])
{
return go(array, n + 1);
}
cout << "不是递增";
return false;
}
int main()
{
int array[5] = { 1, 1, 4, 1, 1 };
go(array, 0);
cout << endl;
system("pause");
return 0;
}
代码下载及其运行
代码下载地址:http://download.csdn.net/detail/yincheng01/6704519
解压密码:c.itcast.cn
下载代码并解压后,用VC2013打开interview.sln,并设置对应的启动项目后,点击运行即可,具体步骤如下:
1)设置启动项目:右键点击解决方案,在弹出菜单中选择“设置启动项目”
2)在下拉框中选择相应项目,项目名和博客编号一致
3)点击“本地Windows调试器”运行
程序运行结果