C#系列教程——if-else例子2

来源:互联网 发布:我国网络社会治理方针 编辑:程序博客网 时间:2024/06/05 09:45

代码如下:

using System;public class Test2{    static void Main()    {        Console.Write("请输入数据: ");        char c = (char)Console.Read();        if (Char.IsUpper(c))        {            Console.WriteLine("字符是大写字符.");        }        else if (Char.IsLower(c))        {            Console.WriteLine("字符是小写字符.");        }        else if (Char.IsDigit(c))        {            Console.WriteLine("输入是是数字.");        }    }}