以下程序是用简单的开关语句实现天气预报功能,可是却不能执行,高手指点!

来源:百度知道 编辑:UC知道 时间:2024/05/29 00:43:29
嘿,要不然高手帮我用C#编一个吧,交作业,急啊~
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
int i;
do{
i=Int32 .Parse (Console.ReadLine());
}while(i<=3);
switch(i)
{case (0):
Console.WriteLine ("冷");break ;
case (1):
Console.WriteLine ("热");break ;
case (2):
Console.WriteLine ("不冷不热");break ;
default :
Console.WriteLine ("到底是冷是热");break ;

}

}
}
}

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
int i;
do
{
string n = Console.ReadLine();
i = int.Parse(n);
switch (i)
{
case 0:
Console.WriteLine("冷"); break;
case 1:
Console.WriteLine("热"); break;
case 2:
Console.Write("不冷不热"); break;
default:
Console.Write("到底是冷是热"); break;
}
}
while (i <= 3);

}
}