Question: Barry Bruin is learning about recursion, and attempted to write a program that recursively determines whether a provided integer's digits are in non - decreasing

Barry Bruin is learning about recursion, and attempted to write a program that recursively determines whether a provided integer's digits are in non-decreasing order (that is, they are in increasing order, but not necessarily strictly increasing order). As is, the function currently always returns false, asserting that the digits are not in non-decreasing order.
Indicate the changes needed to the code so that it gives the correct output for all possible inputs. Only make changes where the code indicates that they should be made. You may not use for, while, do while, or goto.
bool increasing (unsigned int a)
{
if
if (!increasing (a/10)) return false;
int last = a %10; //the least significant digit
//the second least significant digit, 0 if a10
int prev =(a10)%10;
/* make your changes only below this line. */
if (prev = last) return true;
return false;
}
return false;
}
 Barry Bruin is learning about recursion, and attempted to write a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!