Please help on c program Write a recursive function that ret
Please help on c++ program. Write a recursive function that returns true if the digits of a positive integer are in increasing order; otherwise, the function returns false. Also, write a program to test your function.
Solution
#include<iostream>
using namespace std;
int main()
{
cout<<checkIncOrder(123);
cout<<checkIncOrder(321);
return 0;
}
boolean checkIncOrder(int n)
{
int curr,next,next_curr;
curr=n%10;
next=n/10;
next_curr=next%10;
if(next!=0)
{
if(curr>=next_curr)
{
checkIncOrder(next);
}
else return false;
}
else
return true;
}
