编译能通过,为什么结果不对呢
代码如下:using System;
public class sentence
{
static void Main(string[] args)
{
int age;
Console.WriteLine("Please input your age:");
age=Convert.ToInt16(Console.ReadLine());
switch (age)
{
case 1-18:
Console.WriteLine("You are a children!");
break;
case 18-29:
Console.WriteLine("You are a young man!");
break;
case 30-60:
Console.WriteLine("You are a adult!");
break;
case 60-120:
Console.WriteLine("You are a doyen!");
break;
default:
Console.WriteLine("Error");
break;
}
}
}
编译通过,可是输入一个正常的数如22,结果显示的是"ERROR",是怎么回事?