zoukankan      html  css  js  c++  java
  • 分支结构之SWITCH语句

    SWITCH语句类似于IF语句,根据条件选择执行代码,本示例根据输入的名字,执行相应的问候代码。

    using System;
    namespace a
    {
    	class Program
    	{
    		public static void Main(string[] args)
    		{
    			const string myName="karli";
    			const string sexyName="angelina";
    			const string sillyName="ploppy";
    			string name;
    			Console.WriteLine("What is your name?");
    			name=Console.ReadLine();
    			switch (name.ToLower())
    			{
    				case myName:
    					Console.WriteLine("You have the same name as me!");
    					break;
    				case sexyName:
    					Console.WriteLine("My,what a sexy name you have!");
    					break;
    				case sillyName:
    					Console.WriteLine("The's a very silly name.");
    					break;
    			}
    			Console.WriteLine("Hello {0}!",name);
    			Console.ReadKey();
    		}
    	}
    }
  • 相关阅读:
    单调队列+二分 G
    dp cf 1700 最近几天的刷题
    dp 20190618
    dp 20190617
    dp cf 20190615
    dp cf 20190614
    powercli
    zabbix docker-weixin
    cenetos-大文件排序
    esxcli命令
  • 原文地址:https://www.cnblogs.com/bimgoo/p/2468395.html
Copyright © 2011-2022 走看看