摘要: class Program { enum WeekDay //枚举类型,若enum WeekDay : long 冒号后为指定的类型,默认为int型 { Mon = 1, Tus, Wed, Thu, Fri, Sat, Son } static void Main(string[] args) { 阅读全文
posted @ 2020-09-24 09:42 ___lucky 阅读(165) 评论(0) 推荐(0)
摘要: namespace Demo11_三目运算符 { class Program { static void Main(string[] args) { Console.WriteLine("请输入年龄:"); int age = int.Parse(Console.ReadLine()); strin 阅读全文
posted @ 2020-09-17 15:00 ___lucky 阅读(792) 评论(0) 推荐(0)
摘要: class Program { static void Main(string[] args) { int i = 1; do { Console.WriteLine(i); i++; } while (i<=10); //先执行do,再判断while中的条件 for (int j = 15; j 阅读全文
posted @ 2020-09-17 14:46 ___lucky 阅读(88) 评论(0) 推荐(0)
摘要: class Program { static void Main(string[] args) { /* int x, y, z; x = 95; y = 92; z = 99; if (x >= 90) { Console.WriteLine("x大于90"); } */ int week; wh 阅读全文
posted @ 2020-09-17 14:38 ___lucky 阅读(178) 评论(0) 推荐(0)
摘要: class Program { static void Main(string[] args) { string str = string.Format("我叫{0},来自{1},现居住在{2}", "小明","上海","重庆"); Console.WriteLine(str); int age = 阅读全文
posted @ 2020-09-16 15:44 ___lucky 阅读(80) 评论(0) 推荐(0)
摘要: namespace Demo07_字符串处理2 { class Program { static void Main(string[] args) { char[] ch = { ' ', 'a', 'B', 'g' }; string str = "abcdefg"; Console.WriteL 阅读全文
posted @ 2020-09-16 15:01 ___lucky 阅读(90) 评论(0) 推荐(0)
摘要: namespace String01 { class Program { static void Main(string[] args) { char[] ch1 = { 'a', 'B', 'F' }; string str = "aBcDeFg"; Console.WriteLine(str.T 阅读全文
posted @ 2020-09-16 14:57 ___lucky 阅读(63) 评论(0) 推荐(0)
摘要: namespace Demo05_reverse { class Program { static void Main(string[] args) { float f = 55.5f; //只要是小数就默认为double类型,数字后加f为显式转换,将double转换为float double d 阅读全文
posted @ 2020-09-16 11:39 ___lucky 阅读(208) 评论(0) 推荐(0)
摘要: namespace Demo04 { class Program { static void Main(string[] args) { double d = 123.456; //数字格式说明符 Console.WriteLine("{0:c}",d); //货币符号 Console.WriteL 阅读全文
posted @ 2020-09-16 11:33 ___lucky 阅读(281) 评论(0) 推荐(0)
摘要: namespace Demo03 { class Program { static void Main(string[] args) { /* string str = string.Format("我叫小明,今年22岁,来自上海。"); Console.WriteLine(str); Consol 阅读全文
posted @ 2020-09-16 11:29 ___lucky 阅读(208) 评论(0) 推荐(0)