zoukankan      html  css  js  c++  java
  • 人品计算器 (不用循环语句)

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.Threading.Tasks;
     6 
     7 namespace ConsoleApplication6
     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 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             if (VIP.Contains(name))//使用Contains查找输入的name是否在VIP中,如果在则返回true值
    26             {
    27                 x = 100;
    28             }
    29             //黑名单
    30             if (blacklist.Contains(name))
    31             {
    32                 x = 0;
    33             }
    34             //输出
    35             Console.WriteLine("你的人品值为{0}", x);
    36             if (x > 100)
    37                 Console.WriteLine("简直是人品爆棚!");
    38             else if (x > 80)
    39                 Console.WriteLine("人品不错,平时肯定常干好事");
    40             else if (x > 60)
    41                 Console.WriteLine("你的人品一般般~");
    42             else
    43                 Console.WriteLine("人品太差,好好修炼几年");
    44             Console.ReadKey();
    45         }
    46 
    47 
    48     }
    49 }
  • 相关阅读:
    程序员常用字体(vs2008字体修改方案)
    Struts 与 Velocity 的集成
    CheckBox Button
    WINDOWS MOBILE winnet开发心得
    Change background color of a UIAlertView
    Windows Mobile 自定义控件(一)
    ZNLog
    获取磁盘空间大小
    iPhone开发:UIImage的一系列操作
    Windows Mobile 自定义控件(二)
  • 原文地址:https://www.cnblogs.com/start-from-scratch/p/5054194.html
Copyright © 2011-2022 走看看