接线员'!='不能应用于' bool'类型的操作数和' int' (CS0019)

时间:2017-12-04 12:10:26

标签: c#

当我这样做时,标题中出现错误:

else if (celsius<73 != 0) 
{
    Console.WriteLine("Tyvärr så är " + celsius + "° för låg temperatur, ställ in värmen mellan 73 till 77 grader."); //
    Console.Write("Välj temperatur igen : ");

如果摄氏度为0,我想让它变成假,因为我的英语不好。

3 个答案:

答案 0 :(得分:4)

  

如果摄氏度为0,我希望它出现错误

如果要对变量进行多次比较,则需要单独指定。

因此:

else if (celsius<73 != 0) 

应改为:

else if (celsius<73 && celsius != 0) 

答案 1 :(得分:1)

您无法将boolcelsius<73返回的内容)与整数0进行比较。

我想你希望摄氏度<&lt; 73 != 0:

else if (celsius < 73 && celsius != 0) 
{}

答案 2 :(得分:0)

如果这是真的......

  

如果摄氏度为0,我想让它变成假,因为我的英语不好。

...然后将其更改为:

if (celsius != 0)
{
}
相关问题