C 如果有其他情况,请说明条件签入
如何在“C 如果有其他情况,请说明条件签入,c,if-statement,C,If Statement,如何在“if”条件中执行条件检查 int main() { int a = 0; printf("Enter the number\n"); scanf("%d",&a); if(-600 <= a <= 600) { printf("True"); } else { printf("False"); } return 0; } intmain() { int a
if
”条件中执行条件检查
int main()
{
int a = 0;
printf("Enter the number\n");
scanf("%d",&a);
if(-600 <= a <= 600)
{
printf("True");
}
else
{
printf("False");
}
return 0;
}
intmain()
{
int a=0;
printf(“输入数字”);
scanf(“%d”和“&a”);
if(-600这不是在c中测试区间的方法。你应该使用if(-600)这种语法是无效的,不受支持的。我猜它的结尾好像有括号,(-600正如B.GO所回答的,编程语言中的适当条件是:-600@B.GO:该语法既不无效也不受支持。a重复:,这是否回答了您的问题?
so13.c:9:18: warning: result of comparison of constant 600 with boolean expression is always true [-Wtautological-constant-out-of-range-compare]
if(-600 <= a <= 600)
~~~~~~~~~ ^ ~~~
so13.c: In function ‘main’:
so13.c:9:18: warning: comparison of constant ‘600’ with boolean expression is always true [-Wbool-compare]
if(-600 <= a <= 600)
^~
so13.c:9:13: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses]
if(-600 <= a <= 600)
~~~~~^~~~