编一个程序,首先输入一个成绩(0到100的整数)判断该成绩是优、良、中、及格还是不及格 用c#!!!

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int score=0;
char id = '#';

while(id!='!')
{
score = (int)(Console.Read());
if (score >= 101 || score < 0)
{
Console.Write("error\n");
id = '!';
}
else
if (score <= 100 && score >= 95)
{ Console.Write("优\n"); }
else
if (score < 95 && score >= 80)
{ Console.Write("良\n"); }
else
if (score < 80 && score >= 70)
{ Console.Write("中\n"); }
else
if (score < 70 && score >= 60)
{ Console.Write("及格\n"); }
else
if (score < 60)
{ Console.Write("不及格\n"); }

}
}
}
}

第1个回答  2014-04-24
Console.WriteLine() 是整行输出
你的程序有什么问题吗?追问

就是总是打出只有“不及格”

追答

score =Convert.ToInt32(Console.ReadLine());

追问

成功了,求解啊!!!

追答

read读1个写符,永远是1位数

本回答被提问者采纳
相似回答