c++ - Function with one input behaving different after first call -
C ++ "post-text" itemprop = "text"> I need help with a problem with exponential lubricant in C ++ Smoothing follows this equation: newValue = inputSignal * smoothFactor + (1-smoothFactor) * oldValue My function is only an input parameter Is considered, which can be declared within the inputSignal parameter ( smoothFactor function and is not the subject of the problem) and an output parameter, which is the NewValue is . The issue I am arriving now is that the old value is missing before the calculation, because old value first newValue Function call. Therefore old value is the first value in the call to the first inputSignal . This means that my function needs to be different in my first call compared to each of the following calls if I declare a global i = 0 parameter and first call I count after i ++ , then I can solve it. It is not independent of external circumstances, however, it should be. I was able to solve this problem...