练习2

  

// rise.cpp : Defines the entry point for the console application.
/*
data:2012/10/05
auth:ljz
func:rise
判断数组是不是按升序排列的。
*/

#include "stdafx.h"
#include "iostream"
using namespace std;
bool rise(int b[])
{
for (int i =0;i<sizeof(b);i++)
{
if (b[i]>=b[i+1])
{
return false;
}
}
return true;
}
int main(int argc, char* argv[])
{
int a[6] ={5,4,1,7,9,3};
if (rise(a))
{
cout<<"是升序的"<<endl;
// system("pause");
return 0;
}
// system("pause");
cout<<"这个也不是升序啊!"<<endl;
return -1;
}

原文地址:https://www.cnblogs.com/hackerl/p/3352810.html