Answering "how many sets" with dynamic breakpoints.

I was fiddling around with an excell spreadsheet attempting to get estimations on a formula, but I could really utilize exact numbers. I feel like a computer language would be the best way to gather the information I need, and I used to have the basics of C++ down several years ago.

Essentially I'm trying to answer the question of finding out how many sets of adding a number series that changes with break points(eg 1+1+1+1(until breakpoint)+2+2+2(until breakpoint)+8+8 etc, until you reach a certain stack total.

So basically I have breakpoints. 1, 5, 10, 15, 50, 200. And a dynamic series that changes based on breakpoints. So each breakpoint has a different modifier. Breakpoint 1 in this example is +2. 5=(+3), 10=(+1), 15=(+10).

So for the example, I put 1 through the function. I get...1+2+2(breakpoint achieved)+3+3(breakpoint achieved)+1+1+1+1(breakpoint achieved)+10+10+10+10(breakpoint achieved) and so on. With a running count of how many times it took running through the function to achieve a user input desired result or higher(call the user input end point 52 in this example, yielding a result of 55 total, 13 rotations.).

I feel like this can be achieved through the use of some recursive functions, but I'm a little lost on how to organize all of this(and a little rusty on my programming, but I can figure that out).

Would anyone be willing to help me organize this into a more understandable pseudo code? Being out of programming as long as I have been I don't have the proper line of thinking to figure out the type of formulas I'll need to use.

I'm assuming I need a data array with the set of breakpoints I'm intending to use. Unsure as to how I set the behavioral difference of each breakpoint(+1 or +3 or *.9 or *3.7 etc).

User interface of enter your starting digit, and stop point(breakpoint total).

Then a recursive function taking the starting digit, if it were 7 in the given example, add the breakpoint 5 behavior(+3), +1 to the counter function, check for stop point total, if stop point not reached go back to start. We'd have 10 to it would then add 1, and continue.

So this is my general thought process so far, just a little shaky on bringing it to life. I'd really appreciate any help.
Upon further research, I wasn't aware of multidimensional arrays. Would what I seek to build essentially be a multidimensional array?

Where basically the first line is the raw number(breakpoints), and the second line is their behavior? E.g. this array would be int breakpoint[]{1, 5, 10, 15, 50, 200}, and I could add a second line of {+2, +3, +1, +10}.

Is this something that would be possible?

Then it would just be a matter of making the function I would need.
OP: on the face of it yours seems to be an interesting problem but to have gone unanswered for almost 8 hrs on a seemingly 'slow news' day probably means that there are others facing the same issues that I am viz. a case of incomplete, and possibly inaccurate, understanding of what it is exactly that you're trying to do. Can you try and put it into somepseudocode?? https://en.wikipedia.org/wiki/Pseudocode
Topic archived. No new replies allowed.