Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

Students also viewed these Databases questions

Question

what is a peer Group? Importance?

Answered: 1 week ago