Hey all,

i am currently working on a system that detect the value input and carry out an action is the value is accepted but rests everything when the value is denied. i have an algorithm but i don't seem to be able to transfer it into coding.

Start.
Set x as intiger
Set y as integer
Set z as integer

z = y - (value (which i will have to calculate))

value input is equal to x.
y is the maximum value
z is the minimum value

y increases as x increases (in other words y = x), but when x decreases y does not decrease.

while x >= z then, (does action), else
stop action and reset y value and z value to 0

record next value.

Stop

Please forgive me for my crappy algorithm writing abilities.

All comments and solutions will be appreciated.

Thank you.
HKL-Jerry

Your real problem seems that your algorithm is too unclear. I couldn't code this up since I have no idea what is wanted and I think that is your problem too.

So what you are going to need to do is make this much more concrete: The quickest way to do that is to put down some numbers, i.e. program flow on paper!

So let us follow your current algorithm, you can then fill in the details and we can get back to a real algorithm.

x=10; y=20; z=30;   // set some values
// Now what happens???

So even if you can't write an algorithm [as demonstrated :) ], can we have an example. And in doing the example you will likely find that you can easily write the algorithm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.