diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/Email.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/Email.cs" deleted file mode 100644 index e28cbb24cc66612b72dcdc4c6f1b557f754d68cb..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/Email.cs" +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace ConsoleApp1 -{ - class Email - { - // 用户输入邮箱,请验证其合法性。 - //1、邮箱一定需要 @符号 - //2、根据 @符号分为两部分,“前半部分 @ 后半部分”, - //前半部分可以数字、字母、下划线、中划线、 .(符号点)。但是.(符号点)不能 用在开头也不能用在结尾; - //后半部分可以数字、字母、下划线、中划线、.(符号点),且符号点是必须的,至少出现一次,但不能连续出现, - //且符号点不能在开头,也不能在结尾。 - //后半部分的符号点后面只能是:com、org、net、edu、mil、tv、biz、info - static void Main(string[] args) - { - - email(); - } - - static void email() - { - while (true) - { - Console.WriteLine("请输入邮箱:"); - string email = Console.ReadLine(); - if (Regex.IsMatch(email, @"^(\w|-)+@(\w+)\.(com|org|net|edu|mil|tv|biz|info)$"))//邮箱一定需要 @符号 - { - - Console.WriteLine("正确!"); - } - else - { - Console.WriteLine("错误!"); - } - } - - - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/TelNum.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/TelNum.cs" deleted file mode 100644 index facb6896a332208da0ceddfd263a37bf4caffa29..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/TelNum.cs" +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace Work5._30 -{ - class TelNum - { - static void Main(string[] args) - { - // 用户输入手机号码,请验证其合法性。 - // 手机号码规则: - // 最开头 + 86可有可无 - // 13开头第三位是 0 - 9 - // 14开头第三位是 5或7 - // 15开头第三位是 0 - 9不包含4 - // 17开头第三位是 678中的一个 - // 18开头第三位是 0 - 9 - // 剩下的8位,都是0 - 9的数字。 - while (true) - { - Console.WriteLine("请输入手机号码:"); - string tel = Console.ReadLine(); - if (Regex.IsMatch(tel, @"^(\+86|)((13[0-9])|(14(5,7)|(15[0-3,5-9])|(17(6,7,8)))|(18\d))\d{8}$")) - { - Console.WriteLine("正确"); - } - else - { - Console.WriteLine("错误"); - } - } - - - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/num.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/num.cs" deleted file mode 100644 index a204e87068a7f7cbf81ec095a40536ea3ce74704..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\270\207\347\250\213\347\245\245/num.cs" +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ConsoleApp1 -{ - class Program - { - static void Main(string[] args) - { - ////生成0 - 5之间的随机小数,保留两位小数(必须是2位)。 - //Random ran = new Random(); - //Console.WriteLine("生成0 - 5之间的随机小数,保留两位小数:"); - //Console.WriteLine((ran.NextDouble() * 5).ToString("f2")); - - ////生成4 - 7之间的随机小数,保留两位小数。 - //Console.WriteLine(); - //Console.WriteLine("生成4 - 7之间的随机小数,保留两位小数:"); - //Console.WriteLine((4 + ran.NextDouble() * 3).ToString("f2")); - - Random ra = new Random(); - int[] arr = new int[10]; - int tmp = 0; - for (int i = 0; i < arr.Length; i++) - { - tmp = ra.Next(1, 11); - arr[i] = getNum(arr, ref tmp, ra); - } - for (int i = 0; i < arr.Length; i++) - { - Console.WriteLine(arr[i]); - } - - } - - //生成一个随机整型数组,长度是10,内容是1 ~10,数组内容不重复。 - private static int getNum(int[] arr, ref int tmp, Random ra) - { - int n = 0; - while (n<=arr.Length-1) - { - if (arr[n]==tmp) - { - tmp = ra.Next(1, 11); - getNum(arr, ref tmp, ra); - } - n++; - } - return tmp; - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\275\231\346\200\235\346\235\260/Program.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\275\231\346\200\235\346\235\260/Program.cs" deleted file mode 100644 index 112ba18f93089bee12c4617803451820e6a186ef..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\344\275\231\346\200\235\346\235\260/Program.cs" +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace May_30_2021 -{ - class Program - { - static void Main(string[] args) - { - //1、生成0 - 5之间的随机小数,保留两位小数(必须是2位)。 - - //Random sj = new Random(); - //for (int i = 0; i < 30; i++) - //{ - // double a = sj.NextDouble()*5; - // Console.WriteLine(a.ToString("f2")); - //} - - ////2、生成4 - 7之间的随机小数,保留两位小数。 - //for (int i = 0; i < 30; i++) - //{ - // double b = 4 + sj.NextDouble() * (7 - 4); - // Console.WriteLine(b.ToString("f2")); - //} - - //3、生成一个随机整型数组,长度是10,内容是1~10,数组内容不重复。 - //int[] arr = new int[10]; - //int c; - //for (int i = 1; i <= arr.Length; i++) - //{ - // c = sj.Next(0,10); - // if (arr[c] == 0) - // { - // arr[c] = i; - // } - // else - // { - // i--; - // } - //} - //Console.WriteLine("随机数组为:"); - //foreach (var item in arr) - //{ - // Console.Write(item+" | "); - //} - - // 4、用户输入邮箱,请验证其合法性。 - // 1、邮箱一定需要 @符号 - - // 2、根据 @符号分为两部分,“前半部分 @ 后半部分”,前半部分可以数字、字母、下划线、 - // 中划线、 .(符号点)。但是.(符号点)不能 用在开头也不能用在结尾; - - // 后半部分可以数字、字母、下划线、中划线、.(符号点),且符号点是必须的, - // 至少出现一次,但不能连续出现,且符号点不能在开头,也不能在结尾。 - //后半部分的符号点后面只能是:com、org、net、edu、mil、tv、biz、info - - //Regex email = new Regex(@"^[^.]{1}[\s]{1,}.(com|org|net|edu|mil|tv|biz|info)$"); - //string d = ""; - - //while (true) - //{ - // Console.WriteLine("请输入你的电子邮箱:(0退出)"); - // d = Console.ReadLine(); - - // if (d.Equals("0")) - // { - // break; - // } - // if (email.IsMatch(d)) - // { - // Console.WriteLine("输入格式正确。"); - // } - // else - // { - // Console.WriteLine("输入格式错误!!!"); - // } - //} - - - // 5、用户输入手机号码,请验证其合法性。 - // 手机号码规则: - //最开头 + 86可有可无 - - // 13开头第三位是 0 - 9 - - // 14开头第三位是 5或7 - - // 15开头第三位是 0 - 9不包含4 - - // 17开头第三位是 678中的一个 - - // 18开头第三位是 0 - 9 - - // 剩下的8位,都是0 - 9的数字。 - - Regex telephone = new Regex(@"^(\+86)?(13[0-9]|14[5-7]|15{^40-9]|17[6-8]|18[0-9])([0-9]{8})$"); - string e = ""; - - while (true) - { - Console.WriteLine("请输入手机号码:(0退出)"); - e = Console.ReadLine(); - - if (e.Equals("0")) - { - break; - } - if (telephone.IsMatch(e)) - { - Console.WriteLine("输入格式正确。"); - } - else - { - Console.WriteLine("没有这个手机号码!!!"); - } - } - - - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\345\230\211\344\277\212/Program.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\345\230\211\344\277\212/Program.cs" deleted file mode 100644 index 65f90c7e6a11057e54da6ed48b773b9d2a0a073a..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\345\230\211\344\277\212/Program.cs" +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace Demo11 -{ - class Program - { - static void Main(string[] args) - { - Test5(); - } - - public static void Test1() - { - //1、生成0-5之间的随机小数,保留两位小数(必须是2位) - Random ran = new Random(); - - for (int i = 0; i < 50; i++) - { - double a = ran.NextDouble() * 5; - Console.WriteLine(a.ToString("f2")); - } - } - - public static void Test2() - { - //2、生成4 - 7之间的随机小数,保留两位小数。 - Random ran = new Random(); - - for (int i = 0; i < 50; i++) - { - double b = 4 + ran.NextDouble() * (7 - 4); - Console.WriteLine(b.ToString("f2")); - } - } - - public static void Test3() - { - //3、生成一个随机整型数组,长度是10,内容是1~10,数组内容不重复。 - Random ran = new Random(); - int[] arr = new int[10]; - for (int i = 0; i < arr.Length;) - { - int a = ran.Next(0,11); - if (Array.IndexOf(arr,a)==-1) - { - arr[i] = a; - i++; - } - } - foreach (var item in arr) - { - Console.Write(item+" "); - } - - - } - - public static void Test4() - { - - //4、用户输入邮箱,请验证其合法性。 - Console.WriteLine("请输入:"); - string email = Console.ReadLine(); - bool result = Regex.IsMatch(email, @"^(\w)+(\.?)(\w)*@(\w)+(\.(com|org|net|edu|mil|tv|biz|info))$"); - Console.WriteLine(result); - } - - public static void Test5() { - //用户输入手机号码,请验证其合法性。 - Console.WriteLine("请输入:"); - string tel = Console.ReadLine(); - bool result = Regex.IsMatch(tel, @"^(\+86)?((13\d{1})|(14(5|7))|(15([0-3]{1}|[5-9]{1}))|(17(6|7|8))|(18\d{1}))(\d{8})$"); - Console.WriteLine(result); - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\345\273\272\345\263\260/Program.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\345\273\272\345\263\260/Program.cs" deleted file mode 100644 index 163a8133a34bf6c612230363f3a39ab93791dc10..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\345\273\272\345\263\260/Program.cs" +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace ConsoleApp1 -{ - class Program - { - static void Main(string[] args) - { - Lianxi04(); - } - public static void Lianxi01() - { - Random ran = new Random(); - - for (int i = 0; i < 20; i++) - { - double d = ran.NextDouble() * 5; - Console.WriteLine(d.ToString("f2")); - } - } - public static void Lianxi02() - { - Random ran = new Random(); - for (int i = 0; i < 20; i++) - { - double b = 4 + ran.NextDouble() * (7 - 4); - Console.WriteLine(b.ToString("f2")); - - } - } - public static void Lianxi03() - { - int[] arr = new int[10]; - Random a = new Random(); - for (int i = 0; i < arr.Length;) - { - int b = a.Next(0, 11); - if (Array.IndexOf(arr,b)==-1) - { - arr[i] = b; - i++; - } - } - foreach (var item in arr) - { - Console.Write(item+" "); - } - } - public static void Lianxi04() - { - - Console.Write("请输入您的邮箱:"); - string str = Console.ReadLine(); - - if (Regex.IsMatch(str, @"^(\w)+(\.?)(\w)*@(\w)+(\.(com|org|net|edu|mil|tv|biz|info))$")) - { - Console.WriteLine("输入正确"); - } - else - { - Console.WriteLine("输入错误"); - } - } - public static void Lianxi05() - { - Console.WriteLine("请输入你的电话号码"); - string str = Console.ReadLine(); - if (Regex.IsMatch(str, @"^(\+86)?((13\d{1})|(14(5|7))|(15([0-3]{1}|[5-9]{1}))|(17(6|7|8))|(18\d{1}))(\d{8})$")) - { - Console.WriteLine("输入正确"); - } - else - { - Console.WriteLine("输入错误"); - } - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Program.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Program.cs" deleted file mode 100644 index 839cac4e26196a5213c65c6294f7564b76249cf7..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\346\226\207\345\274\272/Program.cs" +++ /dev/null @@ -1,135 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace ConsoleApp1 -{ - class Program - { - static void Main(string[] args) - { - //a(); - //b(); - c(); - //d(); - //f(); - } - public static void a() - { - //1、生成0-5之间的随机小数,保留两位小数(必须是2位)。 - Random random = new Random(); - for (int i = 0; i < 10; i++) - { - double a=random.NextDouble()+random.Next(6); - - Console.WriteLine(a.ToString("f2")); - } - - } - public static void b() - { - //2、生成4-7之间的随机小数,保留两位小数。 - Random random = new Random(); - for (int i = 0; i < 10; i++) - { - double a = random.Next(4,8) + random.NextDouble(); - Console.WriteLine(a.ToString("f2")); - } - } - public static void c() - { - //3、生成一个随机整型数组,长度是10,内容是1~10,数组内容不重复。 - int[] a = new int [10]; - Random random = new Random(); - - for (int i = 0; i < a.Length; i++) - { - a[i] = random.Next(1, 11); - for (int j = 0; j < i; j++) - { - if (a[i]==a[j]) - { - i--; - } - } - - } - for (int i = 0; i < a.Length; i++) - { - Console.WriteLine(a[i]); - - } - - } - public static void d() - { - //4、用户输入邮箱,请验证其合法性。 - // 1、邮箱一定需要 @符号 - - // 2、根据 @符号分为两部分,“前半部分 @ 后半部分”, - //前半部分可以数字、字母、下划线、中划线、 .(符号点)。但是.(符号点)不能 用在开头也不能用在结尾; - - // 后半部分可以数字、字母、下划线、中划线、.(符号点),且符号点是必须的,至少出现一次,但不能连续出现,且符号点不能在开头,也不能在结尾。 - //后半部分的符号点后面只能是:com、org、net、edu、mil、tv、biz、info - while (true) - { //@\w(.com|.org|.net|.edu|.mil|.tv|.biz|.info) - Console.WriteLine("请输入邮箱开头6位数的"); - string a= Console.ReadLine(); - if (Regex.IsMatch(a, @"^(\w....\w)@(\w\w)[.]{1}(com|org|net|edu|mil|tv|biz|info)$")) - { - Console.WriteLine(a); - Console.WriteLine("正确"); - } - else - { - Console.WriteLine("错误"); - } - } - - } - public static void f() - { - /*/5、用户输入手机号码,请验证其合法性。 - 手机号码规则: - 最开头+86可有可无 - 13开头第三位是 0-9 - 14开头第三位是 5或7 - 15开头第三位是 0-9不包含4 - 17开头第三位是 678中的一个 - 18开头第三位是 0-9 - 剩下的8位,都是0-9的数字。/*/ - while (true) - { - Console.WriteLine("请输入手机号码"); - string a= Console.ReadLine(); - if (Regex.IsMatch(a, @"^(13)[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$")) - { - Console.WriteLine("正确"+"+86 "+a); - } - else if (Regex.IsMatch(a, @"^(14)(5|7)[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$")) - { - Console.WriteLine("正确" + "+86 " + a); - } - else if (Regex.IsMatch(a, @"^(15)(0|1|2|3|5|6|7|8|9)[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$")) - { - Console.WriteLine("正确" + "+86 " + a); - } - else if (Regex.IsMatch(a, @"^(17)(6|7|8)[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$")) - { - Console.WriteLine("正确" + "+86 " + a); - } - else if (Regex.IsMatch(a, @"^(18)[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$")) - { - Console.WriteLine("正确" + "+86 " + a); - } - else - { - Console.WriteLine("错误重新输入"); - } - } - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\351\237\265\345\251\267/Class1.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\351\237\265\345\251\267/Class1.cs" deleted file mode 100644 index 6411e025ef6db70905e395c89758f7c033d2832f..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\210\230\351\237\265\345\251\267/Class1.cs" +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace ZYL -{ - class Class1 - { - static void Main(string[] args) - { - //1、生成0-5之间的随机小数,保留两位小数(必须是2位)。 - - Random ran = new Random(); - for (int i = 0; i < 10; i++) - { - double d = ran.NextDouble() * 5; - Console.WriteLine(d.ToString("f2")); - } - //2、生成4-7之间的随机小数,保留两位小数。 - - Random ran1 = new Random(); - for(int i = 0; i < 10; i++) - { - double d1 = 4 + ran.NextDouble() * (7 - 4); - Console.WriteLine(d1.ToString("f2")); - } - //3、生成一个随机整型数组,长度是10,内容是1 ~10,数组内容不重复。 - - int[] arr = new int[10]; - Random ran2 = new Random(); - for (int i = 0; i < arr.Length; i++) - { - int d3 = ran.Next(1, 11); - arr[i] = d3; - for (int j = 0; j < i; j++) - { - if (arr[i] == arr[j]) - { - i = i - 1; - } - } - } - foreach (int item in arr) - { - Console.Write(item + " "); - } - /*4、用户输入邮箱,请验证其合法性。 - 1、邮箱一定需要 @符号 - 2、根据 @符号分为两部分,“前半部分 @ 后半部分”, - 前半部分可以数字、字母、下划线、中划线、 .(符号点)。但是.(符号点)不能 用在开头也不能用在结尾; - 后半部分可以数字、字母、下划线、中划线、.(符号点),且符号点是必须的,至少出现一次,但不能连续出现,且符号点不能在开头,也不能在结尾。 - 后半部分的符号点后面只能是:com、org、net、edu、mil、tv、biz、info*/ - - Console.WriteLine("请输入你的邮箱地址"); - string str = Console.ReadLine(); - if (Regex.IsMatch(str, @"^(\w)+(\.\w)*@(\w)+(\.(com|org|net|edu|mil|tv|biz|info))$")) - { - Console.WriteLine("正确"); - } - else - { - Console.WriteLine("错误"); - } - /*5、用户输入手机号码,请验证其合法性。 - 手机号码规则: - 最开头 + 86可有可无 - 13开头第三位是 0 - 9 - 14开头第三位是 5或7 - 15开头第三位是 0 - 9不包含4 - 17开头第三位是 678中的一个 - 18开头第三位是 0 - 9 - 剩下的8位,都是0 - 9的数字。*/ - - Console.WriteLine("请输入手机号码:"); - string str1 = Console.ReadLine(); - if (Regex.IsMatch(str, @"^((13)+[0-9]+\d{8})|((14)+(5|7)+\d{8})|((15)+((0|1|2|3)|[5-9])+\d{8})|((17)+(6|7|8)+\d{8}|((18)+[0-9]+\d{8}))$")) - { - Console.WriteLine("正确"); - } - else - { - Console.WriteLine("错误"); - } - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/Program.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/Program.cs" deleted file mode 100644 index 3db8f9b455ab66ca8d2fc8dc32d57770d2ab7164..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\220\264\347\205\214/Program.cs" +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace ConsoleApp1 -{ - class Program - { - static void Main(string[] args) - { - //1、生成0-5之间的随机小数,保留两位小数(必须是2位)。 - Random ran = new Random(); - Console.WriteLine("------------第一题----------------"); - for (int i = 0; i < 10; i++) - { - double d = ran.NextDouble() * 5; - Console.WriteLine(d.ToString("f2")); - } - Console.WriteLine("------------第二题----------------"); - // 2、生成4 - 7之间的随机小数,保留两位小数 - for (int i = 0; i < 10; i++) - { - double d = 4 + ran.NextDouble() * (7 - 4); //min+......(max-min) - Console.WriteLine(d.ToString("f2")); - - } - Console.WriteLine("------------第三题----------------"); - //3、生成一个随机整型数组,长度是10,内容是1~10,数组内容不重复。 - - Random a = new Random(); - int[] arr = new int[10]; - for (int i = 0; i < arr.Length; i++) - { - int c = a.Next(1, 11); - arr[i] = c; - for (int j = 0; j < i; j++) - { - if (arr[i] == arr[j]) - { - i--; - } - } - } - for (int i = 0; i < arr.Length; i++) - { - Console.Write(arr[i] + " "); - } - Console.WriteLine(); - Console.WriteLine("------------第四题----------------"); - // 4、用户输入邮箱,请验证其合法性。 - // 1、邮箱一定需要 @符号 - // 2、根据 @符号分为两部分,“前半部分 @ 后半部分”, - // 前半部分可以数字、字母、下划线、中划线、 .(符号点)。但是.(符号点)不能 用在开头也不能用在结尾; - // 后半部分可以数字、字母、下划线、中划线、.(符号点),且符号点是必须的,至少出现一次,但不能连续出现,且符号点不能在开头,也不能在结尾。 - // 后半部分的符号点后面只能是:com、org、net、edu、mil、tv、biz、info - - //while (true) - //{ - // Console.WriteLine("请输入邮箱:"); - // string str = Console.ReadLine(); - // if (Regex.IsMatch(str, @"^(\w+)(\.*)(\w+)@(\w+)(\.)(com|org|net|edu|mil|tv|biz|info)$")) - // { - // Console.WriteLine(str); - // } - // else - // { - - // Console.WriteLine("格式有误"); - - // } - //} - Console.WriteLine("------------第五题----------------"); - // 5、用户输入手机号码,请验证其合法性。 - // 手机号码规则: - // 最开头 + 86可有可无 - // 13开头第三位是 0 - 9 - // 14开头第三位是 5或7 - // 15开头第三位是 0 - 9不包含4 - // 17开头第三位是 678中的一个 - // 18开头第三位是 0 - 9 - // 剩下的8位,都是0 - 9的数字。 - - while (true) - { - - Console.WriteLine("请输入手机号:"); - string tel = Console.ReadLine(); - if (Regex.IsMatch(tel, @"^(\+86)?(13\d{1}|14[5-7]{1}|15[0-3|5-9]{1}|17[6-8]{1}|18\d{1})(\d{8})$")) - { - Console.Write(tel); - } - else - { - Console.WriteLine("输入有误"); - } - Console.WriteLine(); - } - - - - - - - - } - - - - - - - - - - } -} - diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\224\220\344\274\237\345\273\272/Program.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\224\220\344\274\237\345\273\272/Program.cs" deleted file mode 100644 index dd974a6c49215f573106e76ca5320ba5def85e8e..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\345\224\220\344\274\237\345\273\272/Program.cs" +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace ConsoleApp1 -{ - class Program - { - static void Main(string[] args) - { - //1、生成0 - 5之间的随机小数,保留两位小数(必须是2位)。 - Random r = new Random(); - //Console.WriteLine(r.NextDouble()*5); - - ////2、生成4 - 7之间的随机小数,保留两位小数。 - //Console.WriteLine(4+r.NextDouble() * (7-4)); - - - - ////3、生成一个随机整型数组,长度是10,内容是1~10,数组内容不重复。 - int[] arr1 = {1,2,3,4,5,6,7,8,9,10,-1 }; - int[] arr = new int[10]; - int index = -1; - - for (int i = 0; i < arr.Length; i++) - { - index = r.Next(10); - for (int j = 0; j = 0); - arr[i] = a; - Console.WriteLine(arr[i]+" "); - } - Console.WriteLine(); - //youxiang(); - Phone(); - - - - - - Console.ReadKey(); - } - static void youxiang() - { - //1、邮箱一定需要 @符号 - //2、根据 @符号分为两部分,“前半部分 @ 后半部分”, - // 前半部分可以数字、字母、下划线、中划线、 .(符号点)。但是.(符号点)不能 用在开头也不能用在结尾; - - // 后半部分可以数字、字母、下划线、中划线、.(符号点),且符号点是必须的,至少出现一次,但不能连续出现,且符号点不能在开头,也不能在结尾。 - // 后半部分的符号点后面只能是:com、org、net、edu、mil、tv、biz、info - - // |**编号**|**字符**|**描述**| - //|------|------|------| - //|1 |. |匹配除换行符以外的所有字符| - //|2 |\w |[a-z0-9A-Z_] 匹配字母、数字、下画线| - //|3 |\s |匹配空白符(空格)| - //|4 |\d |[0-9] 匹配数字| - //|5 |\b |匹配表达式的开始或结束| - //|6 |^ |匹配表达式的开始| - //|7 |$ |匹配表达式的结束| - - //正则表达式中表示重复的字符 - - //|**编 号**|**字 符**|**描 述**| - //|------|------|------| - //|1 |* |0次或多次字符| - //|2 |? |0次或1次字符| // 前半部分可以数字、字母、下划线、中划线、 .(符号点)。但是.(符号点)不能 用在开头也不能用在结尾; - //|3 |+ |1次或多次字符| // 后半部分可以数字、字母、下划线、中划线、.(符号点),且符号点是必须的,至少出现一次,但不能连续出现,且符号点不能在开头,也不能在结尾。 - //|4 |{n} |n次字符| // 后半部分的符号点后面只能是:com、org、net、edu、mil、tv、biz、info - //|5 |{n,M} |n到M次字符| - //|6 |{n, } |n次以上字符| - - Console.WriteLine("输入一个邮箱:"); - string a = Console.ReadLine(); - if (Regex.IsMatch(a, @"^[\w]+(\.|[\w])*@[\w]+(\.(com|org|net|edu|mil|tv|biz|info))$")) - { - Console.WriteLine("正确!!!"); - } - else - { - Console.WriteLine("错误!!!"); - } - } - static void Phone() - { - Console.WriteLine("请输入一个手机号:"); - string phone = Console.ReadLine(); - if (Regex.IsMatch(phone, @"^(\+86)?((13\d{1})|(14(5|7))|(15[3-9]{1})|(16[5-9]{1})|(17([6-8]{1}))|(18(\d{1})))\d{8}$")) - { - Console.WriteLine("正确!!!"); - } - else - { - Console.WriteLine("错误!!!"); - } - } - - - } - - } diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\350\203\241\350\266\212/Program.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\350\203\241\350\266\212/Program.cs" deleted file mode 100644 index a327868a70e6a2e9634b15625651fa60e7681180..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\350\203\241\350\266\212/Program.cs" +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace ConsoleApp1 -{ - class Program - { - static void Main(string[] args) - { - //1、生成0-5之间的随机小数,保留两位小数(必须是2位)。 - Random ran = new Random(); - Console.WriteLine((ran.NextDouble()*5).ToString("f2")); - - //2、生成4 - 7之间的随机小数,保留两位小数。 - Console.WriteLine((ran.NextDouble() * (7-4)+4).ToString("f2")); - - //3、生成一个随机整型数组,长度是10,内容是1~10,数组内容不重复。 - - int[] arr = new int[10]; - int a; - for (int i = 1; i < 11; i++) - { - a = ran.Next(0, 10); - if (arr[a]==0) - { - arr[a] = i; - } - else - { - i--; - } - } - - Console.WriteLine("生成数组为:"); - foreach (var item in arr) - { - Console.Write(item+" "); - } - Console.WriteLine(); - - - - // 4、用户输入邮箱,请验证其合法性。 - //1、邮箱一定需要 @符号 - - // 2、根据 @符号分为两部分,“前半部分 @ 后半部分”, - // 前半部分可以数字、字母、下划线、中划线、 .(符号点)。但是.(符号点)不能 用在开头也不能用在结尾; - - // 后半部分可以数字、字母、下划线、中划线、.(符号点),且符号点是必须的,至少出现一次,但不能连续出现,且符号点不能在开头,也不能在结尾。 - // 后半部分的符号点后面只能是:com、org、net、edu、mil、tv、biz、info - - //Regex email = new Regex(@"^[^.]{1}[\S]{1,}[^.]@[\S]{1,}.(com|org|net|edu|mil|tv|biz|info)$"); - //string emNum = ""; - - //while (true) - //{ - // Console.WriteLine("请输入电子邮箱:(-1退出)"); - // emNum = Console.ReadLine(); - // if (emNum.Equals("-1")) - // { - // break; - // } - - // if (email.IsMatch(emNum)) - // { - // Console.WriteLine("正确"); - // } - // else - // { - // Console.WriteLine("错误"); - // } - //} - - - - //5、用户输入手机号码,请验证其合法性。 - //手机号码规则: - //最开头 + 86可有可无 - //13开头第三位是 0 - 9 - //14开头第三位是 5或7 - //15开头第三位是 0 - 9不包含4 - //17开头第三位是 678中的一个 - //18开头第三位是 0 - 9 - //剩下的8位,都是0 - 9的数字。 - - Regex telNumber = new Regex(@"^(\+86)?(13[0-9]|14[5-7]|15{^40-9]|17[6-8]|18[0-9])([0-9]{8})$"); - string telNum = ""; - - while (true) - { - Console.WriteLine("请输入电话号码:(-1退出)"); - telNum = Console.ReadLine(); - - if (telNum.Equals("-1")) - { - break; - } - - if (telNumber.IsMatch(telNum)) - { - Console.WriteLine("正确"); - } - else - { - Console.WriteLine("错误"); - } - } - - - - } - } -} diff --git "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\350\222\262\346\231\223\351\252\217/Program.cs" "b/\347\254\2545\346\254\241\344\275\234\344\270\232/\350\222\262\346\231\223\351\252\217/Program.cs" deleted file mode 100644 index 7d57daf223c26ff41113c371b1eea75a2d234953..0000000000000000000000000000000000000000 --- "a/\347\254\2545\346\254\241\344\275\234\344\270\232/\350\222\262\346\231\223\351\252\217/Program.cs" +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace ConsoleApp1 -{ - class Program - { - static void Main(string[] args) - { - //1、生成0 - 5之间的随机小数,保留两位小数(必须是2位)。 - Random r = new Random(); - //Console.WriteLine(r.NextDouble()*5); - - ////2、生成4 - 7之间的随机小数,保留两位小数。 - //Console.WriteLine(4+r.NextDouble() * (7-4)); - - - - ////3、生成一个随机整型数组,长度是10,内容是1~10,数组内容不重复。 - int[] arr1 = {1,2,3,4,5,6,7,8,9,10,-1 }; - int[] arr = new int[10]; - int index = -1; - - for (int i = 0; i < arr.Length; i++) - { - index = r.Next(10); - for (int j = 0; j