OK, let me look at this some more and I'll see if I can get help.
My own difficulty is that the original code I posted does actually work - I tested it. After that I omitted some of the details simply to keep down the size of the post - and also to give you a little bit of something to do. If I'd just pasted the entire code and you ran it, how much would you learn?
I don't know whether or not you ever got that first version to work (which as I say I tested, so I'm certain that the structure is correct). Because I don't know whether you got that far, I don't know how best to advise.
What I do see is that you have moved on from that version, changed the code by introducing a new function. Now that's perfectly fine, nothing wrong with that as an idea. But as you can tell, I'm not sure at what point in this whole thing it fell apart for you.
I don't understand why you cannot simply explain how to pass base and divd to another function to be used? |
I illustrated it by example - that's one part of the explanation. I also pointed you towards two tutorial pages - that's the other part of the explanation.
Did you read through the tutorial? Have you tried to compile and run the examples and see what happens when you do so? That's the way to begin to understand the subject. Plus, you could also try modifying the example code from the tutorial, play around with it, see whether what happens matches what you expect to happen.
To be honest, if I sat down next to you we could work through it together and I'm sure you'd be pretty much up to speed after about 30 minutes. But trying to do this online is much harder - for both of us.