Console.Title = "人品计算机控制台版本";
//软件技术2班
//作者:B16
//完成日期:2014年11月25日
//1.输入姓名并保存
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("请输入你姓名");
string strName = "";
strName = Console.ReadLine();
int score = 0;
string comment = "";
//5.特例处理VIP1.0
string[] vipNames = { "好人1", "好人2", "好人3", "好人4", "好人5" };
foreach (string item in vipNames)
{
if (strName.Equals(item))//判断strName是否等于
{
score = 100;
comment = "绝世好人";
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
Console.ReadKey();
return;
}
}
//5.特例处理黑名单
string[] badguyNames = { "坏人1", "坏人2", "坏人3" };
foreach (string item in badguyNames)
{
if (strName.Equals(item))//判断strName是否等于
{
score = 0;
comment = "差评包邮";
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
Console.ReadKey();
return;
}
}
//5.特例处理VIP2.0
string[,] vipNamesSex = { {"好人11","男" },
{"好人22","女"},
{"好人33","男"},
{"好人44","女"},
{ "好人55","男"} };
for (int i = 0; i < vipNamesSex.GetLength(0); i++)
{
if (strName.Equals(vipNamesSex[i, 0]))
{
score = 100;
if (vipNamesSex[i, 1].Equals("男")) comment = "绝世叼男";
else if (vipNamesSex[i, 1].Equals("女")) comment = "绝世腐女";
else comment = "绝世好人";
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
Console.ReadKey();
return;
}
}
for (int i = 0; i < strName.Length; i++)
{
score += (int)strName[i];
}
//3.将分数控制在100以内
score %= 100;
//4.根据score分值给出对应的评语(switch结构)
switch (score / 10)
{
case 0:
case 1: comment = "0分,人品太差,无法对你评价!"; break;
case 2:
case 3: comment = "100块都不给我,还想得高分好评"; break;
case 4:
case 5: comment = "一般一般,天下第三"; break;
case 6:
case 7: comment = "你会突然火起来的滑板鞋哦"; break;
case 8:
case 9: comment = "太叼了,已经超神啦,绝对好评"; break;
}
//6.输出整体评价
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
//软件技术2班
//作者:B16
//完成日期:2014年11月25日
//1.输入姓名并保存
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("请输入你姓名");
string strName = "";
strName = Console.ReadLine();
int score = 0;
string comment = "";
//5.特例处理VIP1.0
string[] vipNames = { "好人1", "好人2", "好人3", "好人4", "好人5" };
foreach (string item in vipNames)
{
if (strName.Equals(item))//判断strName是否等于
{
score = 100;
comment = "绝世好人";
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
Console.ReadKey();
return;
}
}
//5.特例处理黑名单
string[] badguyNames = { "坏人1", "坏人2", "坏人3" };
foreach (string item in badguyNames)
{
if (strName.Equals(item))//判断strName是否等于
{
score = 0;
comment = "差评包邮";
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
Console.ReadKey();
return;
}
}
//5.特例处理VIP2.0
string[,] vipNamesSex = { {"好人11","男" },
{"好人22","女"},
{"好人33","男"},
{"好人44","女"},
{ "好人55","男"} };
for (int i = 0; i < vipNamesSex.GetLength(0); i++)
{
if (strName.Equals(vipNamesSex[i, 0]))
{
score = 100;
if (vipNamesSex[i, 1].Equals("男")) comment = "绝世叼男";
else if (vipNamesSex[i, 1].Equals("女")) comment = "绝世腐女";
else comment = "绝世好人";
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
Console.ReadKey();
return;
}
}
for (int i = 0; i < strName.Length; i++)
{
score += (int)strName[i];
}
//3.将分数控制在100以内
score %= 100;
//4.根据score分值给出对应的评语(switch结构)
switch (score / 10)
{
case 0:
case 1: comment = "0分,人品太差,无法对你评价!"; break;
case 2:
case 3: comment = "100块都不给我,还想得高分好评"; break;
case 4:
case 5: comment = "一般一般,天下第三"; break;
case 6:
case 7: comment = "你会突然火起来的滑板鞋哦"; break;
case 8:
case 9: comment = "太叼了,已经超神啦,绝对好评"; break;
}
//6.输出整体评价
Console.Clear();
Console.WriteLine("人品评估报告");
Console.WriteLine("姓名:{0}", strName);
Console.WriteLine("分值:{0}", score);
Console.WriteLine("评价:{0}", comment);
Console.ReadKey();