C 未定义的字符或整数 #包括 #包括 #杂注警告(禁用:4996) int main() { 煤焦温度[20]; printf(“温度是多少”); 扫描频率(“%s”,温度); 如果(温度>=32=19=40) { printf(“%s度!好的,伙计,现在是时候换上空调了,费斯特先生”,温度); } 否则,如果(temp

C 未定义的字符或整数 #包括 #包括 #杂注警告(禁用:4996) int main() { 煤焦温度[20]; printf(“温度是多少”); 扫描频率(“%s”,温度); 如果(温度>=32=19=40) { printf(“%s度!好的,伙计,现在是时候换上空调了,费斯特先生”,温度); } 否则,如果(temp,c,C,条件temp>=32=32)=32将变为0或1(根据比较结果),则它们总是小于39 您应该使用temp>=32&&temp=19=19&&tempif(temp>=32if(temp>=32&&temp=19)注意您的编译器警告。如果您提高编译器警告级别,您可能只会得到一条“表达式始终为真”的警告。 #include <stdio.h> #include <stdlib.h> #pragma warning(disable : 4996) int main() {

条件
temp>=32=32)=32
将变为
0
1
(根据比较结果),则它们总是小于39


您应该使用
temp>=32&&temp=19=19&&temp
if(temp>=32
if(temp>=32&&temp=19)注意您的编译器警告。如果您提高编译器警告级别,您可能只会得到一条“表达式始终为真”的警告。
#include <stdio.h>
#include <stdlib.h>
#pragma warning(disable : 4996)

int main()
{

    char temp[20];
    printf("Whats the temperature\n");
    scanf("%s", temp);
    if (temp >= 32 <= 39)
    {
        printf(" %s degrees! It is too hot mister cool it down buddy", temp);
    }
    else if (temp >= 19 <= 32)
    {
        printf(" %s degrees! that is quite the nice temperature", temp);
    }
    else if (temp >= 40)
    {
        printf(" %s degrees! okey buddy now its time to put on AC mister fister", temp);
    }
    else if (temp <= 18)
    {
        printf("%s degrees! That is quite chilly my friend, wanna put on a jacket maybe?", temp);
    }
    getch();
    return 0;
}
int temp; /* char -> int, no array */
printf("Whats the temperature\n");
scanf("%d", &temp); /* %s -> %d, add & */