I have two arrays in my code each one of them have 7 elements, I used a for loop:
for (int i = 0; i < 7; i++)
{
distance = x[++i] - x[i];
area = trapezoidArea(distance, y[++i],y[i]);
sum += area;
}
I wanted to calculate the area of a trapezoid. The difference of x[1]-x[0] will give me the height and y[1] is the first side, and y[0] is the second side.
This for loop doesn't work, and I want to know why.