From 5e7f3a398a7d225c77f7860df1c74b93f311291a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=98=E9=87=91=E9=93=8E?= <562585785@qq.com> Date: Mon, 8 Jun 2020 00:22:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConsoleApp1.sln" | 25 ++++++++ .../ConsoleApp1/ConsoleApp1.csproj" | 8 +++ .../ConsoleApp1/Program.cs" | 57 +++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 "\346\275\230\351\207\221\351\223\216/ConsoleApp1.sln" create mode 100644 "\346\275\230\351\207\221\351\223\216/ConsoleApp1/ConsoleApp1.csproj" create mode 100644 "\346\275\230\351\207\221\351\223\216/ConsoleApp1/Program.cs" diff --git "a/\346\275\230\351\207\221\351\223\216/ConsoleApp1.sln" "b/\346\275\230\351\207\221\351\223\216/ConsoleApp1.sln" new file mode 100644 index 0000000..ce2ad4a --- /dev/null +++ "b/\346\275\230\351\207\221\351\223\216/ConsoleApp1.sln" @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{7D0219A0-0E5C-47D0-9B01-85F5D942B974}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7D0219A0-0E5C-47D0-9B01-85F5D942B974}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7D0219A0-0E5C-47D0-9B01-85F5D942B974}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7D0219A0-0E5C-47D0-9B01-85F5D942B974}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7D0219A0-0E5C-47D0-9B01-85F5D942B974}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {662178E3-2110-44F0-8994-69B4F385CAAB} + EndGlobalSection +EndGlobal diff --git "a/\346\275\230\351\207\221\351\223\216/ConsoleApp1/ConsoleApp1.csproj" "b/\346\275\230\351\207\221\351\223\216/ConsoleApp1/ConsoleApp1.csproj" new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ "b/\346\275\230\351\207\221\351\223\216/ConsoleApp1/ConsoleApp1.csproj" @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git "a/\346\275\230\351\207\221\351\223\216/ConsoleApp1/Program.cs" "b/\346\275\230\351\207\221\351\223\216/ConsoleApp1/Program.cs" new file mode 100644 index 0000000..7cafc9d --- /dev/null +++ "b/\346\275\230\351\207\221\351\223\216/ConsoleApp1/Program.cs" @@ -0,0 +1,57 @@ +using System; + +namespace ConsoleApp1 +{ + class Program + { + static void Main(string[] args) + { /*一维数组数据应用及三种类型 int系统默认值为0而string默认为null*/ + string[] big = new string[5]; + + string[] newBig = { "憨憨", "涵涵", "韩寒" }; + + double[] newBigName = new double[3] { 10.0, 50.6, 30.5 }; + + Console.WriteLine(big); + + Console.WriteLine(newBig); + + Console.WriteLine(newBigName); + + /*二维数组 被包裹在内部如 一维{1,2,3} 二维则把1,2,3看成一个整体内部继续添加多维依次类推*/ + double[,] grade = { { 100, 99.5 }, { 80, 95 }, { 88, 84.5 } }; + for (int i = 0; i < grade.GetLength(0); i++) + { + Console.WriteLine("第" + (i + 1) + "个人的成绩:"); + for (int j = 0; j < grade.GetLength(1); j++) + { + Console.Write(grade[i, j] + ""); + } + Console.WriteLine(); + } + /*foreach foreach(数据类型 变量名 in 数组名){//语句块; }*/ + double[] points = new double[5] { 100, 55, 66.7, 88, 99 }; + double sum = 0; + double avg = 0; + foreach (double point in points) + { + sum = sum + point; + } + avg = sum / points.Length; + Console.WriteLine("总和为:" + sum); + Console.WriteLine("平均数为:" + avg); + /*Split 分割字符输出 只能分割一个字符*/ + string name = "我是人,我是有钱人,我是好人,我不是坏人,我是大大的好人"; + + char[] newName = new char[] { ',' }; + + string[] newNameBig = name.Split(newName); + + for (int i = 0; i < newNameBig.Length; i++) + { + Console.WriteLine(newNameBig[i]); + } + + } + } +} -- Gitee