欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

c# 类 时间

发布时间:2024/8/24 42 豆豆
生活随笔 收集整理的这篇文章主要介绍了 c# 类 时间 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
三、类 namespace String_类_Math_类_ {class Program{static void Main(string[] args){while (true){/* string x; Console.WriteLine("请随便输入:");x= Console.ReadLine();x=x.Trim();//前边的空格和后面的空格都去掉Console.WriteLine(x);*//* string x;Console.WriteLine("请随便输入:");x = Console.ReadLine();int i = x.Length; //字符串有多少位Console.WriteLine(i);//注意这里输出的是数字*//*string x;Console.WriteLine("请随便输入:"); x = Console.ReadLine();x=x.Replace(" ","");//替换成没有空格Console.WriteLine(x);*//* string x;Console.WriteLine("请随便输入:");x = Console.ReadLine();x = x.ToLower(); //把大写字母换成小写字母Console.WriteLine(x);*//* string x;Console.WriteLine("请随便输入:");x = Console.ReadLine();x = x.ToUpper();//把小写字母换成大写字母Console.WriteLine(x);*//* string x, b, c, d; string e = "";Console.WriteLine("请输入您的身份证号:");x=Console.ReadLine();//e = x.Replace("约里克","我的身份证号是");// Console.WriteLine(e);b = x.Substring(6,4);Console.WriteLine("您的出生年为"+b+"年");c = x.Substring(10,2);Console.WriteLine("您的出生月为" + c+"月");d = x.Substring(12,2); Console.WriteLine("您的出生日为" + d+"日");Console.WriteLine("您的出生年月日为"+b+"年"+c+"月"+d+"日");*//*double a, b;Console.WriteLine("请输入一个小数:");a = Convert.ToDouble(Console.ReadLine());b = Math.Ceiling(a);//满足大于a的最小整数Console.WriteLine(b);*//* double a;Console.WriteLine("请输入一个小数:");a = Convert.ToDouble(Console.ReadLine());int b = Convert.ToInt32(Math.Floor(a));//满足小于a的最大整数Console.WriteLine(b);*//*double b,d;b =Math.PI;//圆周率d = Math.Round(b,3);//保留三位小数,四舍五入Console.WriteLine(d);*//*double b, d,e;Console.WriteLine("请随便输入一个数:");b = Convert.ToDouble(Console.ReadLine());d = Math.Sqrt(b);//平方根Console.WriteLine(d);e=Math.Round(d);//保留0位小数,四舍五入Console.WriteLine(e);*//* int s;DateTime dt = DateTime.Now;//获取当前系统的时间Console.WriteLine(dt);s = dt.DayOfYear;//今天是今年的第多少天Console.WriteLine(s);*//* int s;DateTime dt = new DateTime();//将时间初始化Console.WriteLine(dt);*//* string s = Console.ReadLine();DateTime dt = new DateTime();dt =Convert.ToDateTime(s);//转换为时间的格式Console.WriteLine(dt.DayOfYear);//为本年的第几天*/Console.ReadLine();}}} }

 

转载于:https://www.cnblogs.com/w-wz/p/4439663.html

与50位技术专家面对面20年技术见证,附赠技术全景图

总结

以上是生活随笔为你收集整理的c# 类 时间的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。