Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 如果有其他情况,请说明条件签入_C_If Statement - Fatal编程技术网

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)
        ~~~~~^~~~