Dear all, there are several comparison sentences in my program that probably cause serious problem
1 2 3 4 5 6 7 8 9 10 11 12
if (arrayS[0][i]<=1.25)
{
arrayf[0][i]=4*arrayS[0][i]-4;
}
if (1.25<arrayS[0][i]<1.75)
{
arrayf[0][i]=-4*arrayS[0][i]+6;
}
if (1.75<=arrayS[0][i])
{
arrayf[0][i]=4*arrayS[0][i]-8;
}
Especially the sentence if (1.25<arrayS[0][i]<1.75). There shows a warning of unsafe use of type bool.
1.25<arrayS[0][i] this returns a boolean value. Then you try to compare if the boolean value is less than 1.75. You can do that, because true will be treated as 1 and false as 0, but it's probably not what you want. Instead you will have to make two separate comparisons combined with the && operator. if (1.25 < arrayS[0][i] && arrayS[0][i] < 1.75)