#include<iostream> #include<cstdio>
using namespace std;
int main()
{
float s[2] = {0.24};
printf("Is this is true? (1 = yes, 0= false): %d", s[0] >= 0) && (s[0] < (1/7 + 1/14));
printf("\nBefore if: s[%d] %f\n", 0, s[0]);
if ((s[0] >= 0) && (s[0] < (1/7 + 1/14)))
{
s[0] = 10;
}
printf("\nAfter if: s[%d] %f\n", 0, s[0]);
return 0;
}
答案 0 :(得分:0)
printf("Is this is true? (1 = yes, 0= false): %d", s[0] >= 0 && (s[0] < (1/7 + 1/14)))
应该
printf
;
您执行s[0] >= 0
的{{1}},然后在&&
结果上执行printf