From 7b148faccd25f92315350686f15ae944a988f4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Mon, 2 May 2022 02:12:19 +0000 Subject: [PATCH 1/7] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20isas=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../isas\344\275\234\344\270\232/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/.keep" diff --git "a/01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/.keep" "b/01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From b804c916fad460ae4cf094fef85b02c2efb3bdcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Mon, 2 May 2022 02:12:55 +0000 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../isas\344\275\234\344\270\232/Person.cs" | 38 ++++++++++++ .../isas\344\275\234\344\270\232/Program.cs" | 59 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 "01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/Person.cs" create mode 100644 "01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/Program.cs" diff --git "a/01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/Person.cs" "b/01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/Person.cs" new file mode 100644 index 0000000..8b8545b --- /dev/null +++ "b/01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/Person.cs" @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ConsoleApp1 +{ + //设计一个Person抽象类,包含吃饭学习运动3种行为, + abstract class Person + { + public void eat() { } + public void study() { } + public void run() { } + } + //设计一个接口 考试, 只有学生和老师会考试 + interface Iks + { + public void ks() { } + } + //分为工人,学生,老师2种职业 + class gr + { + + } + class student:Iks + { + public void ks() + { + Console.WriteLine("学生会考试"); + } + } + class ls:Iks + { + public void ks() + { + Console.WriteLine("老师会考试"); + } + } +} diff --git "a/01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/Program.cs" "b/01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/Program.cs" new file mode 100644 index 0000000..3632e19 --- /dev/null +++ "b/01\347\277\201\347\253\240\345\275\254/isas\344\275\234\344\270\232/Program.cs" @@ -0,0 +1,59 @@ +using System; + +namespace ConsoleApp1 +{ + class Program + { + //设计一个方法, 模拟让人进入考场, 要求只有会考试的人才能进入,并考试。 + static void Main(string[] args) + { + gr g = new gr(); + student s = new student(); + ls l = new ls(); + for (;;) + { + string n = Console.ReadLine(); + if (n=="工人") + { + if (g is Iks) + { + Iks i = (Iks)g; + i.ks(); + Console.WriteLine("进入考场,并考试"); + } + else + { + Console.WriteLine("不能进入考场"); + } + } + else if (n == "学生") + { + if (s is Iks) + { + Iks i = (Iks)s; + i.ks(); + Console.WriteLine("进入考场,并考试"); + } + else + { + Console.WriteLine("不能进入考场"); + } + } + else if (n == "老师") + { + Iks i = l as Iks; + if (l != null) + { + //Iks i = (Iks)l; + i.ks(); + Console.WriteLine("进入考场,并考试"); + } + else + { + Console.WriteLine("不能进入考场"); + } + } + } + } + } +} -- Gitee From 70429d4804b5c3e4c15c5ca5b0aa9329992f8a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Sun, 8 May 2022 23:59:45 +0000 Subject: [PATCH 3/7] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E6=B3=9B=E5=9E=8B?= =?UTF-8?q?=E9=9B=86=E5=90=88=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/.keep" diff --git "a/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/.keep" "b/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From 00c3999c1be5c0461651254c0b4c5e1757826002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Mon, 9 May 2022 00:00:08 +0000 Subject: [PATCH 4/7] =?UTF-8?q?=E6=96=B0=E5=BB=BA=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/1/.keep" diff --git "a/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/1/.keep" "b/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/1/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From c3777548c69e7be528864e8490bdbe62f03145d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Mon, 9 May 2022 00:00:16 +0000 Subject: [PATCH 5/7] =?UTF-8?q?=E6=96=B0=E5=BB=BA=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/2/.keep" diff --git "a/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/2/.keep" "b/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/2/.keep" new file mode 100644 index 0000000..e69de29 -- Gitee From b280d390456b62910f5566b3720b59397c06c68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Mon, 9 May 2022 00:47:27 +0000 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1/Program.cs" | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/1/Program.cs" diff --git "a/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/1/Program.cs" "b/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/1/Program.cs" new file mode 100644 index 0000000..8942d24 --- /dev/null +++ "b/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/1/Program.cs" @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { + //1.定义两个存放(int)的集合, + //集合listA {“a”,”b”,”c”,”d”,”e”} + //listB {“d”,”e”,”f”,”g”,”h”}, + //将这两个集合去除重复项后合并成一个集合。 Contains + List listA = new List { }; + List listB = new List { }; + int[] a = new int[] { 'a', 'b', 'c', 'd', 'e' }; + int[] b = new int[] { 'd', 'e', 'f', 'g', 'h' }; + listA.AddRange(a); + listB.AddRange(b); + Console.WriteLine(string.Join(" ",listA)); + Console.WriteLine(string.Join(" ", listB)); + int o = 5; + int p = 5; + listA.Contains(o); + for (int i = 0; i < o; i++) + { + if (listA.Contains(listB[i])) + { + listB.RemoveAt(i); + i--; + o--; + } + } + //for (int i = 0; i < o; i++) + //{ + // for (int j = 0; j < p; j++) + // { + // //Console.WriteLine(listA[i]+"\t"+listB[j]); + // if (listA[i] == listB[j]) + // { + // listA.RemoveAt(i); + // o--; + // i--; + // listB.RemoveAt(j); + // j--; + // p--; + // } + // } + //} + Console.WriteLine(string.Join(" ", listA)); + Console.WriteLine(string.Join(" ", listB)); + List list = new List { }; + list.AddRange(listA); + list.AddRange(listB); + Console.WriteLine(string.Join(" ", list)); + } + } +} -- Gitee From be61b086c5e07f561c9fda332cafe16cc29978b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=81=E7=AB=A0=E5=BD=AC?= <2629351295@qq.com> Date: Mon, 9 May 2022 00:48:04 +0000 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2/Program.cs" | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 "01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/2/Program.cs" diff --git "a/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/2/Program.cs" "b/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/2/Program.cs" new file mode 100644 index 0000000..3e3989c --- /dev/null +++ "b/01\347\277\201\347\253\240\345\275\254/\346\263\233\345\236\213\351\233\206\345\220\210\344\275\234\344\270\232/2/Program.cs" @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; + +namespace ConsoleApp4 +{ + class Program + { + static void Main(string[] args) + { + //4.分拣奇偶数 int[]{ 1,2,3,4,5,6,7,8,9} + List ji = new List { }; + List ou = new List { }; + int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + ji.AddRange(a); + ou.AddRange(a); + ji.RemoveAll(x => x % 2 == 0); + ou.RemoveAll(x => x % 2 != 0); + Console.Write("奇数:"); + Console.WriteLine(string.Join(" ", ji)); + Console.Write("偶数:"); + Console.WriteLine(string.Join(" ", ou)); + } + } +} -- Gitee