using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication25
{
class Program
{
static void Main(string[] args)
{
int botton ;
Console.WriteLine("请输入成绩");
botton = int.Parse(Console.ReadLine());
switch (botton)
{
case 1:
Console.Write("这枚同学成绩优秀!");
break;
case 2:
Console.Write("这枚同学成绩及格!");
break;
case 3:
Console.Write("这枚同学成绩不及格啊!");
break;
}
}
}
}
怎样把输入的数字变成case1,2,3,或者怎么把case1,2,3,变成成绩范围?
新手不懂,在线求解!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace sorce
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入分数: ");
int s = int.Parse(Console.ReadLine());
s = s / 10;
switch (s)
{
case 6:Console.WriteLine("成绩及格"); break;
case 7: Console.WriteLine("成绩及格"); break;
case 8: Console.WriteLine("成绩良好"); break;
case 9: Console.WriteLine("成绩优秀"); break;
case 10: Console.WriteLine("成绩优秀"); break;
default:Console.WriteLine("成绩不及格");break;
}
Console.WriteLine("再接再厉!");
Console.ReadLine();
}
}
}