#编码
Console.WriteLine("玩游戏晋级");
int b=1;//局数
int c=0;//80分次数
do
{
Console.Write("你在玩第{0}局,分数是:", b);
string str_goal = Console.ReadLine();
try
{
int goal = Convert.ToInt32(str_goal);
if (goal > 80)
{
c++;
}
b++;
if (b > 5)
{
Console.WriteLine("游戏结束");
}
else
{
Console.Write("是否下一局(yes/no):");
string answer = Console.ReadLine();
if (answer == "no")
{
Console.WriteLine("游戏结束");
break;
}
}
}
catch
{
Console.WriteLine("输入错误");
}
}while (b <= 5);
double pingjun = c / 5.0;
if (b > 5)
{
if (pingjun > 0.8)
{
Console.WriteLine("晋级一级");
}
else if (pingjun > 0.6)
{
Console.WriteLine("晋级二级");
}
else
{
Console.WriteLine("晋级失败");
}
}
else
{
Console.WriteLine("未完成");
}
Console.ReadKey();
网友评论