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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started