Question: I need help with a C++ program: For a char function, the inputted value is an int. The function is to find whether or not
I need help with a C++ program:
For a char function, the inputted value is an int. The function is to find whether or not it is alternating greater than, less than, greater than... (Mountain) OR if it is alternating less than, greater than, less than.... (Valley)
I cannot use a string, array, or vector for this. I know you need to use modulo and some divisors to split up the int but I can't figure out how to cycle through all of it in the proper order.
For example: 1324 would output Mountain (1<3, 3>2, 2<4).../\
5262 would output Valley (5>2, 2<6, 6>2)...\/
45 would output Mountain /
72 would output Valley \
Numbers with the same digits next to each other will return nothing. Ex. 566 would return 0;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
