Kyl*_*e W -2 c# if-statement visual-studio-2012
在尝试根据用户输入的温度输出console应用程序的VSL studio 2012输出建议时,我遇到了错误
"无效的表达术语"
我在此代码中的所有其他if语句.我不知道我在这里做错了什么.
如果有人能指出我正在解决这个问题的方向,那将是惊人的!谢谢
if (temp <= 40)
{
Console.WriteLine(" It is very cold. Put on a heavy coat.");
}
else if (temp > 40 && <= 60)
{
Console.WriteLine("It is cold. Put on a coat.");
}
else if (temp > 60 && <= 70)
{
Console.WriteLine("The temperature is cool. Put on a light jacket.");
}
else if (temp > 70 && <= 80)
{
Console.WriteLine("The temperature is pleasent. You can wear anything you like");
}
else if (temp > 80 && <= 90)
{
Console.WriteLine(" The temperautre is warm, you can wear short sleeves.");
}
else (temp > 90)
{
Console.WriteLine("It is hot. You can wear shorts today.");
}
Run Code Online (Sandbox Code Playgroud)
这不是有效的语法:
else if (temp > 40 && <= 60)
Run Code Online (Sandbox Code Playgroud)
你需要这样做:
else if (temp > 40 && temp <= 60)
Run Code Online (Sandbox Code Playgroud)