• 第六天学习内容 类


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace day06
    {
        class Program
        {
            static void Main(string[] args)
            {
                /*   string x = "   abc     ";
                   int i = x.Length;
                   Console.WriteLine(x);
                   Console.WriteLine(i);
                   Console.WriteLine(x.Trim().Length);  //去掉x中的空格
                   Console.WriteLine(x.TrimEnd().Length);//去掉x中后面的空格
                   Console.WriteLine(x.TrimStart().Length);//去掉x中前面的空格
                   Console.WriteLine(x.ToUpper());  //把x中的小写转为大写


                   Console.WriteLine("请输入你的身份证号");
                  string x= Console.ReadLine();
                  string y = x.Substring(6,8);  //截取x中从第六位开始的8个字符
                  Console.WriteLine(y);
                   string a=y.Substring(0,4);
                   string b=y.Substring(4,2);
                   string c=y.Substring(6,2);
                   Console.WriteLine("您的生日是" + a + "年" + b + "月" + c + "日");
               
                   Console.ReadKey();

                   string z = "我小字不想混字了字";
                   Console.WriteLine("你"+z.Substring(1).Replace("字了字","了").Replace("字","子")); //替换字符


    //提取邮箱的用户名
                Console.WriteLine("请输入你的邮箱地址:");
                string q = Console.ReadLine();
                if (q.Contains("@"))
                {
                    Console.WriteLine("您的用户名是:" + q.Substring(0, q.IndexOf("@")));
                }
                else
                {
                    Console.WriteLine("您的输入有误");
                }
                Console.ReadKey(); 

              


                Console.WriteLine("请输入一个年份");
                string s = Console.ReadLine();
                try
                {
                    DateTime dt = new DateTime();
                    dt = Convert.ToDateTime(s+"/2/29");
                    Console.WriteLine(s+"是闰年");
                }
                catch (Exception)
                {
                    Console.WriteLine(s+"不是闰年");
                   
                }
                Console.ReadKey();


                for (int i = 1; i  <= 20; i ++)
                {
                    for (int j = 1; j <= 20; j++)
                    {
                        if (i==9&&j==9||i==11&j==9||i==9&&j==11||i==11&&j==11||i==10||j==10)
                        {
                            Console.Write("◆");
                        }
                        else
                        {
                            Console.Write("◇");
                        }
                      
                    }
                    Console.Write(" ");
                }
                Console.ReadKey(); 

                string s = "helloworld";
                for (int i = 0; i < s.Length; i++)
                {
                    Console.Write(s.Substring(i, 1).ToUpper()+" ");

                }
                Console.ReadKey();


                Console.WriteLine("是否要烧开水(y/n)");
                string x = Console.ReadLine();
                if (x=="y")
                {
                   
                    for (int i = 0; i <= 100; i++)
                    {


                        switch (i)
                        {
                            case 30:
                                Console.WriteLine("水温了");
                                break;
                            case 50:
                                Console.WriteLine("水热了");
                                break;
                            case 80:
                                Console.WriteLine("水快开了");
                                break;
                            case 100:
                                Console.WriteLine("水已经开了");
                                break;
                            default: Console.WriteLine(i);
                                break;
                        }
                    }
                }
                Console.ReadKey();*/


            }
        }
    }

  • 相关阅读:
    eclipse运行纯servlet程序
    VS中lib和dll
    eclipse部署web项目至本地的tomcat但在webapps中找不到
    【2018.07.28】(字符串/回文串)学习Manacher算法小记
    【2018.07.26】建立博客~
    【2018.07.27】(字符串/找相同)学习KMP算法小记
    [转]数据库范式那些事
    [转]Windows平台下的多线程编程
    mondrian schema学习(1)
    [转]SQL查询入门
  • 原文地址:https://www.cnblogs.com/William-1234/p/4317158.html
Copyright © 2020-2023  润新知