1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace ConsoleApplication5
8 {
9 class Program
10 {
11 static void Main(string[] args)
12 {
13 //练习:人品计算器2.0.增加VIP榜单和黑名单(数组)。
14 //当输入姓名时,若在VIP榜单中,则给予100分,若在黑名单中,则给予0分,若两个榜单都不在,则按正常程序计算分值和评价。
15 string name;
16 int i, x = 0;
17 string[] VIP = { "王", "韦", "魏" };
18 string[] blacklist = { "杨", "林", "安" };
19 Console.WriteLine("请输入你的名字:");
20 name = Console.ReadLine();
21 //普通
22 Random r = new Random();
23 x = r.Next(0, 101);
24 //VIP
25 for (i = 0; i < VIP.Length; i++)
26 {
27 if (name == VIP[i])
28 {
29 x = 100;
30 }
31 }
32 //黑名单
33 for (i = 0; i < blacklist.Length; i++)
34 {
35 if (name == blacklist[i])
36 {
37 x = 0;
38 }
39 }
40 Console.WriteLine("你的人品值为{0}", x);
41 if (x > 100)
42 Console.WriteLine("简直是人品爆棚!");
43 else if (x > 80)
44 Console.WriteLine("人品不错,平时肯定常干好事");
45 else if (x > 60)
46 Console.WriteLine("你的人品一般般~");
47 else
48 Console.WriteLine("人品太差,好好修炼几年");
49 Console.ReadKey();
50 }
51 }
52 }