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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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 0000000000000000000000000000000000000000..8b8545bd5db88a7981d1fddaeb68aedb5a90c3f2 --- /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 0000000000000000000000000000000000000000..3632e19abf53da5e0854aa3dc28625ebad29e636 --- /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("不能进入考场"); + } + } + } + } + } +} 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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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 0000000000000000000000000000000000000000..8942d24f2a31502a5f7702fa39e392ae2d8e2b88 --- /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)); + } + } +} 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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 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 0000000000000000000000000000000000000000..3e3989c0279716e4f76bbf53654542e0e3ca77c1 --- /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)); + } + } +}