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);//注意這里輸出的是數(shù)字*//*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("請輸入一個小數(shù):");a = Convert.ToDouble(Console.ReadLine());b = Math.Ceiling(a);//滿足大于a的最小整數(shù)Console.WriteLine(b);*//* double a;Console.WriteLine("請輸入一個小數(shù):");a = Convert.ToDouble(Console.ReadLine());int b = Convert.ToInt32(Math.Floor(a));//滿足小于a的最大整數(shù)Console.WriteLine(b);*//*double b,d;b =Math.PI;//圓周率d = Math.Round(b,3);//保留三位小數(shù),四舍五入Console.WriteLine(d);*//*double b, d,e;Console.WriteLine("請隨便輸入一個數(shù):");b = Convert.ToDouble(Console.ReadLine());d = Math.Sqrt(b);//平方根Console.WriteLine(d);e=Math.Round(d);//保留0位小數(shù),四舍五入Console.WriteLine(e);*//* int s;DateTime dt = DateTime.Now;//獲取當(dāng)前系統(tǒng)的時間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);//轉(zhuǎn)換為時間的格式Console.WriteLine(dt.DayOfYear);//為本年的第幾天*/Console.ReadLine();}}}
}
?
轉(zhuǎn)載于:https://www.cnblogs.com/w-wz/p/4439663.html
與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖總結(jié)
- 上一篇: 读《JavaScript dom编程艺术
- 下一篇: Scrum学习