Question1: How to express attt without having this error? can not implicitly convert type double to double? This error refers to line 7.
Question2: How to calculate this value? mymax = maximum (attt[1], attt[2], ...attt[count])? Please note that i want to subtract attt[0] from mymax that is in my first question but both if them are at the same loop. But if it can't be at the same loop, please code it somehow that it works.
Thanks in advance for your time and help.
Double to double? The message probably has more than that.
subtract attt[0] from mymax attt[0] - mymax
Who substracts from whom?
You have two lists of values, old and neww. They must have same number of elements and they must have at least one element each.
You compute elementwise difference of the two lists; a new list.
However, you apparently don't want a whole list, just the largest difference and the difference of the first pair: auto result = neww[0] - old[0] - mymax;
How to calculate maximum(attt[1], attt[2], ...attt[count])?
Is that the maximum of whole list or does it omit the first (attt[0])?
You do look each element in turn. If its value is larger than the largest value (mymax) that you have seen so far, then you must update the mymax. When you have seen all the values, the mymax must hold the largest value of the whole list.
Let me explain more. Neww and old have functions in other parts and they work well. The thing i am looking for is it:
There is a for loop and i want to Calculate this:
attt[0] : is being calculated by the loop as well as attt[1], attt[2], attt[3], attt[4], attt[5] and so on. All of these variables keep double amounts.
mymax: holds the maximum value of attt[1], attt[2], attt[3], attt[4], attt[5] and....
attt: keeps the subtraction result of attt[0] and mymax. And it is defined in the first line as double.
how can i do that? If you provide me the code, that would be perfect.
You have attt and attt and they are entirely different. One is a double value. The other is an array of double values. One number, many numbers. Not possible. Rename one of the two.
It is apparent that you do need attt later. However, you have not stated that you would need attt for anything else than computing the attt. (Was that clear? Not ambiguous? Can you tell which attt is which? Rename one.)
When i insert attt in another defined function like beliw, it works fine without any problem.
attt=function1(attt) ;
But when i add it to thus function, attt = attt[0]- mymax; the double to double conversion problem arises.
What should i do now to fix it? :(