Archived
1
0
This commit is contained in:
2025-11-15 20:25:57 +08:00
parent 5478d0ed37
commit bb4a37acc4
99 changed files with 4315 additions and 16 deletions

11
15.1/15.1.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_15._1</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
15.1/15.1.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15.1", "15.1.csproj", "{816086E8-93CF-41C4-8DC4-EE4B44FE918B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{816086E8-93CF-41C4-8DC4-EE4B44FE918B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{816086E8-93CF-41C4-8DC4-EE4B44FE918B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{816086E8-93CF-41C4-8DC4-EE4B44FE918B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{816086E8-93CF-41C4-8DC4-EE4B44FE918B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F6856EF0-4074-451B-9ED7-D1F4FC4E61BD}
EndGlobalSection
EndGlobal

54
15.1/Program.cs Normal file
View File

@@ -0,0 +1,54 @@
using System;
using System.Drawing;
namespace _15._1
{
class MathTriangle
{
private double sideA;
private double sideB;
private double sideC;
public MathTriangle(double a, double b, double c)
{
sideA = Math.Abs(a);
sideB = Math.Abs(b);
sideC = Math.Abs(c);
}
public double GetArea()
{
double s = (sideA + sideB + sideC) / 2;
return Math.Sqrt(s * (s - sideA) * (s - sideB) * (s - sideC));
}
public double GetPerimeter()
{
return sideA + sideB + sideC;
}
public double GetHeight()
{
double area = GetArea();
return (2 * area) / sideA;
}
public double GetMaxSide()
{
return Math.Max(sideA, Math.Max(sideB, sideC));
}
public double GetMinSide()
{
return Math.Min(sideA, Math.Min(sideB, sideC));
}
private double GetPartSideA()
{
return Math.Sqrt((Math.Pow(sideB, 2.0) - Math.Pow(GetHeight(), 2.0)));
}
static void Main()
{
MathTriangle triangle = new MathTriangle(16.0, 10.0, 8.0);
Console.WriteLine("三角形三边长分别为: {0}, {1}, {2}", triangle.sideA, triangle.sideB, triangle.sideC);
Console.WriteLine("三角形的面积为: {0:#.00}", triangle.GetArea());
Console.WriteLine("三角形的周长为: {0}", triangle.GetPerimeter());
Console.WriteLine("三角形的A边高为: {0:#.00}", triangle.GetHeight());
Console.WriteLine("三角形的最大边为: {0}", triangle.GetMaxSide());
Console.WriteLine("三角形的最小边为: {0}", triangle.GetMinSide());
}
}
}

11
15.2/15.2.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_15._2</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
15.2/15.2.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15.2", "15.2.csproj", "{19E0F84F-ABD6-4CA7-A1FE-ECFA8580D0CA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19E0F84F-ABD6-4CA7-A1FE-ECFA8580D0CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19E0F84F-ABD6-4CA7-A1FE-ECFA8580D0CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19E0F84F-ABD6-4CA7-A1FE-ECFA8580D0CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19E0F84F-ABD6-4CA7-A1FE-ECFA8580D0CA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {99434B3A-CA5C-4FB3-AB1F-F7DA100B86A5}
EndGlobalSection
EndGlobal

30
15.2/Program.cs Normal file
View File

@@ -0,0 +1,30 @@
using System;
using System.Threading;
namespace _15._2
{
public class RandomObjectDemo
{
static void RunIntRan(Random randObj)
{
for (int i = 0; i < 6; i++)
{
Console.Write("{0,10}", randObj.Next());
}
for (int i = 0;i < 6; i++)
{
Console.Write('{1,10}',randObj.NextDouble());
}
}
static void Fixseed(Random randObj)
{
Random fixseed = new Random();
fixseed.Next();
}
static void autoseed()
{
Thread.Sleep(1);
Console.WriteLine("时间");
}
}
}

11
15.3/15.3.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_15._3</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
15.3/15.3.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15.3", "15.3.csproj", "{9E5AF88C-21DA-425C-A729-EF94F8612EBA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9E5AF88C-21DA-425C-A729-EF94F8612EBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E5AF88C-21DA-425C-A729-EF94F8612EBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E5AF88C-21DA-425C-A729-EF94F8612EBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E5AF88C-21DA-425C-A729-EF94F8612EBA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A401EAC7-95C0-4EE7-AACB-4DCF57437BA2}
EndGlobalSection
EndGlobal

26
15.3/Program.cs Normal file
View File

@@ -0,0 +1,26 @@
namespace _15._3
{
internal class Program
{
static void Main(string[] args)
{
const string s4 = " ";
int nYear = DateTime.Today.Year;
int nMonth = DateTime.Today.Month;
DateTime d1 = new DateTime(nYear, nMonth, 1);
Console.WriteLine("{0}/{1}", d1.Year, d1.Month);
Console.WriteLine("SUN MON TUE WED THU FRI SAT");
int iWeek = (int)d1.DayOfWeek;
int iLastDay = d1.AddMonths(1).AddDays(-1).Day;
for (int i = 0; i < iWeek; i++)
{
Console.Write(s4);
}
for (int i = 1; i <= iLastDay; i++)
{
Console.Write(" {0:00} ", i);
if ((i + iWeek) % 7 == 0) Console.WriteLine();
}
}
}
}

11
15_4/15_4.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_15_4</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
15_4/15_4.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15_4", "15_4.csproj", "{A5D84909-CEAE-418D-8431-F44DFC39C3AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A5D84909-CEAE-418D-8431-F44DFC39C3AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5D84909-CEAE-418D-8431-F44DFC39C3AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5D84909-CEAE-418D-8431-F44DFC39C3AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5D84909-CEAE-418D-8431-F44DFC39C3AF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8D89CBFF-8DF9-4F24-8802-9BF5740164E4}
EndGlobalSection
EndGlobal

36
15_4/Program.cs Normal file
View File

@@ -0,0 +1,36 @@
using System;
using System.Collections;
namespace _15_4
{
internal class Program
{
static void Main(string[] args)
{
int countA = 0, countE = 0, countI = 0, countO = 0, countU = 0, countALL = 0;
string str = Console.ReadLine();
str = str.ToUpper();
char[] chars = str.ToCharArray();
foreach (char c in chars)
{
countALL++;
switch (c)
{
case 'A': countA++; break;
case 'E': countE++; break;
case 'I': countI++; break;
case 'O': countO++; break;
case 'U': countU++; break;
default: break;
}
}
Console.WriteLine(countALL);
Console.WriteLine(str);
Console.WriteLine("A:{0}", countA);
Console.WriteLine("E:{0}", countE);
Console.WriteLine("I:{0}", countI);
Console.WriteLine("O:{0}", countO);
Console.WriteLine("U:{0}", countU);
}
}
}

11
15_5/15_5.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_15_5</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
15_5/15_5.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15_5", "15_5.csproj", "{79BC6493-706C-4DCF-A78E-30B0D2CB1FA8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{79BC6493-706C-4DCF-A78E-30B0D2CB1FA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79BC6493-706C-4DCF-A78E-30B0D2CB1FA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79BC6493-706C-4DCF-A78E-30B0D2CB1FA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79BC6493-706C-4DCF-A78E-30B0D2CB1FA8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {908C2BE7-032B-4A3E-BCBD-721A5B8AF689}
EndGlobalSection
EndGlobal

19
15_5/Program.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
using System.Text;
namespace _15_5
{
internal class Program
{
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder("ABC", 50);
sb.Append(new char[] { 'D', 'F', 'E' });
sb.AppendFormat("GHI{0}{1}", 'J', 'k');
Console.WriteLine("{0} chars,内容为{1}", sb.Length, sb.ToString());
sb.Insert(0, "Alphabet---");
sb.Replace('k', 'K');
Console.WriteLine("{0} chars,内容为{1}", sb.Length, sb.ToString());
}
}
}

11
15_7/15_7.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_15_7</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
15_7/15_7.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15_7", "15_7.csproj", "{79C1A3AF-2C09-4966-8EC3-9156C7A58750}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{79C1A3AF-2C09-4966-8EC3-9156C7A58750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79C1A3AF-2C09-4966-8EC3-9156C7A58750}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79C1A3AF-2C09-4966-8EC3-9156C7A58750}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79C1A3AF-2C09-4966-8EC3-9156C7A58750}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {322B6BB6-0C56-4401-8745-CB8F1D6304A0}
EndGlobalSection
EndGlobal

23
15_7/Program.cs Normal file
View File

@@ -0,0 +1,23 @@
using System.Text.RegularExpressions;
namespace _15_7
{
internal class Program
{
static void Main(string[] args)
{
MatchCollection mc;
string[] result = new string[20]; int[] matchposition = new int[20];
Regex r = new Regex("abc");
mc = r.Matches("123abc4abcd");
Console.WriteLine("源字符串123abc4abcd");
Console.WriteLine("匹配字符串abc");
for (int i = 0; i < mc.Count; i++)
{
result[i] = mc[i].Value;
matchposition[i] = mc[i].Index;
Console.WriteLine("索引位置{0};结果{1}", mc[i].Index, mc[i].Value);
}
}
}
}

11
15_8/15_8.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_15_8</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
15_8/15_8.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15_8", "15_8.csproj", "{F3D96B0F-364E-4EAB-9C50-8EABCE6F748E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F3D96B0F-364E-4EAB-9C50-8EABCE6F748E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3D96B0F-364E-4EAB-9C50-8EABCE6F748E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3D96B0F-364E-4EAB-9C50-8EABCE6F748E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3D96B0F-364E-4EAB-9C50-8EABCE6F748E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {22C79536-29FB-4BFC-BC82-AC3EFA5DF606}
EndGlobalSection
EndGlobal

16
15_8/Program.cs Normal file
View File

@@ -0,0 +1,16 @@
using System;
using System.Text.RegularExpressions;
namespace _15_8
{
internal class Program
{
static void Main(string[] args)
{
string strIn = @"~@ How are you doing? Finethanks";
string result = Regex.Replace(strIn, @"[^\w\. ?,]", "");
Console.WriteLine(strIn);
Console.WriteLine(result);
}
}
}

11
15_9/15_9.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_15_9</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
15_9/15_9.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15_9", "15_9.csproj", "{42964642-3419-4B4C-82EE-6648B8E1AF09}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{42964642-3419-4B4C-82EE-6648B8E1AF09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42964642-3419-4B4C-82EE-6648B8E1AF09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42964642-3419-4B4C-82EE-6648B8E1AF09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42964642-3419-4B4C-82EE-6648B8E1AF09}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0E8A3FC7-2195-445C-89F7-8C03A042ADC5}
EndGlobalSection
EndGlobal

10
15_9/Program.cs Normal file
View File

@@ -0,0 +1,10 @@
namespace _15_9
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}

11
16/16.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_16</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
16/16.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "16", "16.csproj", "{A5B25E25-EF1D-47F6-AB55-E0AC5C40E712}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A5B25E25-EF1D-47F6-AB55-E0AC5C40E712}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5B25E25-EF1D-47F6-AB55-E0AC5C40E712}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5B25E25-EF1D-47F6-AB55-E0AC5C40E712}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5B25E25-EF1D-47F6-AB55-E0AC5C40E712}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F7A0EDA2-542E-4CE2-91F6-575C0D8277BC}
EndGlobalSection
EndGlobal

22
16/Program.cs Normal file
View File

@@ -0,0 +1,22 @@
namespace _16
{
internal class Program
{
private const string FILE_NAME = @"c:\temp\TestFile.txt";
static void Main(string[] args)
{
using (StreamReader sr = new StreamReader(FILE_NAME))
{
try
{
String line;
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}
catch (Exception e) { Console.WriteLine(e.Message); }
}
}
}
}

11
16_2/16_2.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_16_2</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
16_2/16_2.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "16_2", "16_2.csproj", "{894B436F-A57A-4945-9B44-C9F2999B099D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{894B436F-A57A-4945-9B44-C9F2999B099D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{894B436F-A57A-4945-9B44-C9F2999B099D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{894B436F-A57A-4945-9B44-C9F2999B099D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{894B436F-A57A-4945-9B44-C9F2999B099D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D6F600F8-25B4-4E93-AF52-22E987FC78C2}
EndGlobalSection
EndGlobal

33
16_2/Program.cs Normal file
View File

@@ -0,0 +1,33 @@
using System;
using System.IO;
namespace _16_2
{
class CopyDir
{
static public void CopyDirectory(string srcDir, string dstDir)
{
DirectoryInfo src = new DirectoryInfo(srcDir);
DirectoryInfo dst = new DirectoryInfo(dstDir);
if (!src.Exists) return;
if (!dst.Exists) dst.Create();
FileInfo[] sfs = src.GetFiles();
for (int i = 0; i < sfs.Length; i++) File.Copy(sfs[i].FullName, sfs[i].FullName + "\\" + sfs[i].Name, true);
DirectoryInfo[] srcDirs = src.GetDirectories();
for (int j = 0; j < srcDirs.Length; j++)
CopyDirectory(srcDirs[j].FullName, dst.FullName + "\\" + srcDirs[j].Name);
}
static void Main(string[] args)
{
try
{
string src = args[0];
string dst = args[1];
CopyDirectory(src, dst);
Console.WriteLine("\n 源目录{0}的内容已复制到目标目录{1}中", src, dst);
}
catch (Exception e) { Console.WriteLine("\n 操作失败 {0}", e.ToString()); }
finally { }
}
}
}

11
16_3/16_3.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_16_3</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
16_3/16_3.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "16_3", "16_3.csproj", "{516064BC-53EE-4754-B189-5AF7DE4BA648}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{516064BC-53EE-4754-B189-5AF7DE4BA648}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{516064BC-53EE-4754-B189-5AF7DE4BA648}.Debug|Any CPU.Build.0 = Debug|Any CPU
{516064BC-53EE-4754-B189-5AF7DE4BA648}.Release|Any CPU.ActiveCfg = Release|Any CPU
{516064BC-53EE-4754-B189-5AF7DE4BA648}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {592FA477-A757-4C0E-83CA-53B7B59DDBEF}
EndGlobalSection
EndGlobal

26
16_3/Program.cs Normal file
View File

@@ -0,0 +1,26 @@
using System;
using System.IO;
namespace _16_3
{
class Program
{
private const string FILE_NAME = @"c:\temp\TestFile.txt";
static void Main(string[] args)
{
using (StreamWriter sw = new StreamWriter(FILE_NAME))
{
sw.Write("文本文件");
sw.Write("的写入/读取");
sw.WriteLine("-----------------------");
sw.WriteLine("写入整数{0},或浮点数{1}", 1, 4.2);
bool b = false; char grade ='A'; string s = "Multiple Data Type!";
sw.WriteLine("写入布尔值、字符、字符串、日期:");
sw.WriteLine(b);
sw.WriteLine(grade);
sw.WriteLine(s);
sw.Write("当前日期:");sw.WriteLine(DateTime.Now);
}
}
}
}

11
16_7/16_7.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_16_7</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
16_7/16_7.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "16_7", "16_7.csproj", "{33890FA2-C6D8-4655-9C73-C57015E7EDA2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{33890FA2-C6D8-4655-9C73-C57015E7EDA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33890FA2-C6D8-4655-9C73-C57015E7EDA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33890FA2-C6D8-4655-9C73-C57015E7EDA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33890FA2-C6D8-4655-9C73-C57015E7EDA2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6B7FEDF5-3E35-4C46-886A-78630949426A}
EndGlobalSection
EndGlobal

10
16_7/Program.cs Normal file
View File

@@ -0,0 +1,10 @@
namespace _16_7
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp7", "ConsoleApp7.csproj", "{D142C263-3F9B-4B2C-96D8-91555668D07F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D142C263-3F9B-4B2C-96D8-91555668D07F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D142C263-3F9B-4B2C-96D8-91555668D07F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D142C263-3F9B-4B2C-96D8-91555668D07F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D142C263-3F9B-4B2C-96D8-91555668D07F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A6F2247D-28F8-40E7-A68F-9A39C987FF1D}
EndGlobalSection
EndGlobal

26
ConsoleApp7/Program.cs Normal file
View File

@@ -0,0 +1,26 @@
namespace ConsoleApp7
{
internal class Program
{
static void Main()
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine(d.Name);
Console.WriteLine(d.DriveType);
if (d.IsReady == true)
{
Console.WriteLine("卷标{0}", d.VolumeLabel);
Console.WriteLine("文件系统{0}", d.DriveFormat);
Console.WriteLine("可用空间{0,15}bytes", d.AvailableFreeSpace);
Console.WriteLine("总可用空间{0,15}bytes", d.TotalFreeSpace);
Console.WriteLine("磁盘总大小{0,15}bytes", d.TotalSize);
}
}
}
}
}

6
HelloWorld/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

64
HelloWorld/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,64 @@
namespace HelloWorld
{
partial class Hello_World
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(236, 156);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(591, 426);
this.button1.TabIndex = 0;
this.button1.Text = "say";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Hello_World
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1054, 769);
this.Controls.Add(this.button1);
this.Cursor = System.Windows.Forms.Cursors.Cross;
this.Name = "Hello_World";
this.Text = "Hello World";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
}
}

30
HelloWorld/Form1.cs Normal file
View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HelloWorld
{
public partial class Hello_World : Form
{
public Hello_World()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Hello World");
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}

120
HelloWorld/Form1.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E37BC2C4-B352-4A78-BD8A-3CDDF322D223}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>HelloWorld</RootNamespace>
<AssemblyName>HelloWorld</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

25
HelloWorld/HelloWorld.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36705.20 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "HelloWorld.csproj", "{E37BC2C4-B352-4A78-BD8A-3CDDF322D223}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E37BC2C4-B352-4A78-BD8A-3CDDF322D223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E37BC2C4-B352-4A78-BD8A-3CDDF322D223}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E37BC2C4-B352-4A78-BD8A-3CDDF322D223}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E37BC2C4-B352-4A78-BD8A-3CDDF322D223}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4D8B2E62-4DC9-4BD4-956F-2846C6B73BEA}
EndGlobalSection
EndGlobal

22
HelloWorld/Program.cs Normal file
View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HelloWorld
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Hello_World());
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("HelloWorld")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HelloWorld")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("e37bc2c4-b352-4a78-bd8a-3cddf322d223")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace HelloWorld.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HelloWorld.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace HelloWorld.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

103
WindowsFormsApp1/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,103 @@
namespace WindowsFormsApp1
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(55, 52);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(44, 18);
this.label1.TabIndex = 0;
this.label1.Text = "复制";
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(78, 109);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(295, 217);
this.richTextBox1.TabIndex = 1;
this.richTextBox1.Text = "";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(366, 364);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(94, 44);
this.button1.TabIndex = 2;
this.button1.Text = "复制文字";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.CausesValidation = false;
this.textBox1.Location = new System.Drawing.Point(439, 109);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox1.Size = new System.Drawing.Size(302, 217);
this.textBox1.TabIndex = 3;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.label1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
}
}

40
WindowsFormsApp1/Form1.cs Normal file
View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
richTextBox1.Text = @"TextBox控件用于输入文本信息" +
@"此控件具有windows文本框控件所没有的" +
@"附加功能,包括多行编辑和密码字符屏蔽";
textBox1.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text += richTextBox1.SelectedText;
richTextBox1.SelectionFont = new Font("Kaiti", 24, FontStyle.Bold);
richTextBox1.SelectionColor = System.Drawing.Color.Red;
}
}
}

120
WindowsFormsApp1/Form1.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("WindowsFormsApp1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WindowsFormsApp1")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("96efcf33-f88b-4af9-a162-8b3e87c946ec")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsApp1.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsApp1.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsApp1.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{96EFCF33-F88B-4AF9-A162-8B3E87C946EC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WindowsFormsApp1</RootNamespace>
<AssemblyName>WindowsFormsApp1</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>C:\Users\BI\Desktop\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>5FE4E351DDEE03F11108E06DB0BCCC3691E5FDCD</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>WindowsFormsApp1_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="WindowsFormsApp1_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36705.20 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp1", "WindowsFormsApp1.csproj", "{96EFCF33-F88B-4AF9-A162-8B3E87C946EC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{96EFCF33-F88B-4AF9-A162-8B3E87C946EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96EFCF33-F88B-4AF9-A162-8B3E87C946EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96EFCF33-F88B-4AF9-A162-8B3E87C946EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96EFCF33-F88B-4AF9-A162-8B3E87C946EC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB850310-348D-44FF-AB13-148BBCDD72FA}
EndGlobalSection
EndGlobal

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

242
WindowsFormsApp2/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,242 @@
namespace WindowsFormsApp2
{
partial class Diaocha
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.Name = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.button1 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.Message = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(163, 39);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(180, 28);
this.label1.TabIndex = 0;
this.label1.Text = "个人信息调查";
//
// Name
//
this.Name.Location = new System.Drawing.Point(150, 95);
this.Name.Name = "Name";
this.Name.Size = new System.Drawing.Size(238, 28);
this.Name.TabIndex = 1;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButton2);
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Location = new System.Drawing.Point(150, 163);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(238, 50);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(125, 14);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(51, 22);
this.radioButton2.TabIndex = 1;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "女";
this.radioButton2.UseVisualStyleBackColor = true;
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(18, 14);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(51, 22);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "男";
this.radioButton1.UseVisualStyleBackColor = true;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.checkBox4);
this.groupBox2.Controls.Add(this.checkBox3);
this.groupBox2.Controls.Add(this.checkBox2);
this.groupBox2.Controls.Add(this.checkBox1);
this.groupBox2.Location = new System.Drawing.Point(150, 259);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(238, 100);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
//
// checkBox4
//
this.checkBox4.AutoSize = true;
this.checkBox4.Location = new System.Drawing.Point(125, 65);
this.checkBox4.Name = "checkBox4";
this.checkBox4.Size = new System.Drawing.Size(70, 22);
this.checkBox4.TabIndex = 3;
this.checkBox4.Text = "运动";
this.checkBox4.UseVisualStyleBackColor = true;
//
// checkBox3
//
this.checkBox3.AutoSize = true;
this.checkBox3.Location = new System.Drawing.Point(18, 66);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(70, 22);
this.checkBox3.TabIndex = 2;
this.checkBox3.Text = "阅读";
this.checkBox3.UseVisualStyleBackColor = true;
//
// checkBox2
//
this.checkBox2.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(125, 27);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(70, 22);
this.checkBox2.TabIndex = 1;
this.checkBox2.Text = "旅游";
this.checkBox2.UseVisualStyleBackColor = true;
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(18, 28);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(70, 22);
this.checkBox1.TabIndex = 0;
this.checkBox1.Text = "音乐";
this.checkBox1.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Location = new System.Drawing.Point(198, 388);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 29);
this.button1.TabIndex = 4;
this.button1.Text = "提交";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(61, 98);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 18);
this.label2.TabIndex = 5;
this.label2.Text = "姓名";
this.label2.Click += new System.EventHandler(this.label2_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(64, 176);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(44, 18);
this.label3.TabIndex = 6;
this.label3.Text = "性别";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(64, 268);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 18);
this.label4.TabIndex = 7;
this.label4.Text = "爱好";
//
// Message
//
this.Message.AutoSize = true;
this.Message.Location = new System.Drawing.Point(96, 428);
this.Message.Name = "Message";
this.Message.Size = new System.Drawing.Size(62, 18);
this.Message.TabIndex = 8;
this.Message.Text = "label5";
//
// Diaocha
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(460, 523);
this.Controls.Add(this.Message);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.Name);
this.Controls.Add(this.label1);
this.Name = "Diaocha";
this.Text = "调查";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox Name;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.CheckBox checkBox4;
private System.Windows.Forms.CheckBox checkBox3;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label Message;
}
}

39
WindowsFormsApp2/Form1.cs Normal file
View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class Diaocha : Form
{
public Diaocha()
{
InitializeComponent();
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Message.Text = Name + "您好!";
if (radioButton1.Checked) Message.Text += "\n 您的性别是:" + radioButton1.Text;
else if (radioButton2.Checked) Message.Text += "\n 您的性别是:" + radioButton2.Text;
Message.Text += "\n 您的爱好是:";
if (checkBox1.Checked) Message.Text += checkBox1.Text + "";
if (checkBox2.Checked) Message.Text += checkBox2.Text + "";
if (checkBox3.Checked) Message.Text += checkBox3.Text + "";
if (checkBox4.Checked) Message.Text += checkBox4.Text + "";
if (!checkBox1.Checked && !checkBox2.Checked && !checkBox3.Checked && !checkBox4.Checked)
Message.Text += "您居然没有兴趣爱好!";
}
}
}

120
WindowsFormsApp2/Form1.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
internal static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Diaocha());
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("WindowsFormsApp2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WindowsFormsApp2")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("da844edf-3c52-4daf-9cc5-4fbb4bc3d243")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsApp2.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsApp2.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WindowsFormsApp2.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DA844EDF-3C52-4DAF-9CC5-4FBB4BC3D243}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WindowsFormsApp2</RootNamespace>
<AssemblyName>WindowsFormsApp2</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36705.20 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp2", "WindowsFormsApp2.csproj", "{DA844EDF-3C52-4DAF-9CC5-4FBB4BC3D243}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DA844EDF-3C52-4DAF-9CC5-4FBB4BC3D243}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA844EDF-3C52-4DAF-9CC5-4FBB4BC3D243}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA844EDF-3C52-4DAF-9CC5-4FBB4BC3D243}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA844EDF-3C52-4DAF-9CC5-4FBB4BC3D243}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D29C43C0-ABD6-4F3C-B8A1-4FB512380B60}
EndGlobalSection
EndGlobal

View File

@@ -1,20 +1,89 @@
// CPP5.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include <iostream>
typedef struct Node
{
int data;
Node* next;
} Node;
// 链式基数排序
Node* radixSort(Node* head)
{
if (head == NULL) return NULL;
int max = head->data;
Node* current = head;
while (current != NULL)
{
if (current->data > max) max = current->data;
current = current->next;
}
// 基数排序
for (int exp = 1; max / exp > 0; exp *= 10)
{
Node* buckets[10] = { NULL };
Node* tails[10] = { NULL };
current = head;
while (current != NULL)
{
Node* next = current->next; // 保存下一个节点
current->next = NULL; // 断开,防止形成环或错连
int digit = (current->data / exp) % 10;
if (buckets[digit] == NULL)
{
buckets[digit] = current;
tails[digit] = current;
}
else
{
tails[digit]->next = current;
tails[digit] = current;
}
current = next;
}
Node* newHead = NULL;
Node* newTail = NULL;
for (int i = 0; i < 10; i++)
{
if (buckets[i] != NULL)
{
if (newHead == NULL)
{
newHead = buckets[i];
newTail = tails[i];
}
else
{
newTail->next = buckets[i];
newTail = tails[i];
}
}
}
if (newTail != NULL)
newTail->next = NULL;
head = newHead;
}
return head;
}
int main()
{
std::cout << "Hello World!\n";
}
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单
// 入门使用技巧:
// 1. 使用解决方案资源管理器窗口添加/管理文件
// 2. 使用团队资源管理器窗口连接到源代码管理
// 3. 使用输出窗口查看生成输出和其他消息
// 4. 使用错误列表窗口查看错误
// 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目
// 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件
srand((unsigned int)time(NULL));
Node* head = NULL;
for (int i = 0; i < 100000; i++)
{
Node* newNode = (Node*)malloc(sizeof(Node));
newNode->data = rand() % 100;
newNode->next = head;
head = newNode;
}
printf("链表已创建!\n");
double clock1 = clock();
head = radixSort(head);
double clock2 = clock();
printf("排序完成:\n");
printf("排序时间: %f 秒\n", (double)(clock2 - clock1) / CLOCKS_PER_SEC);
return 0;
}

89
cs4/CPP5/作业5.cpp Normal file
View File

@@ -0,0 +1,89 @@
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
typedef struct Node
{
int data;
Node* next;
} Node;
// 链式基数排序
Node* radixSort(Node* head)
{
if (head == NULL) return NULL;
int max = head->data;
Node* current = head;
while (current != NULL)
{
if (current->data > max) max = current->data;
current = current->next;
}
// 基数排序
for (int exp = 1; max / exp > 0; exp *= 10)
{
Node* buckets[10] = { NULL };
Node* tails[10] = { NULL };
current = head;
while (current != NULL)
{
Node* next = current->next; // 保存下一个节点
current->next = NULL; // 断开,防止形成环或错连
int digit = (current->data / exp) % 10;
if (buckets[digit] == NULL)
{
buckets[digit] = current;
tails[digit] = current;
}
else
{
tails[digit]->next = current;
tails[digit] = current;
}
current = next;
}
Node* newHead = NULL;
Node* newTail = NULL;
for (int i = 0; i < 10; i++)
{
if (buckets[i] != NULL)
{
if (newHead == NULL)
{
newHead = buckets[i];
newTail = tails[i];
}
else
{
newTail->next = buckets[i];
newTail = tails[i];
}
}
}
if (newTail != NULL)
newTail->next = NULL;
head = newHead;
}
return head;
}
int main()
{
srand((unsigned int)time(NULL));
Node* head = NULL;
for (int i = 0; i < 100000; i++)
{
Node* newNode = (Node*)malloc(sizeof(Node));
newNode->data = rand() % 100;
newNode->next = head;
head = newNode;
}
printf("链表已创建!\n");
double clock1 = clock();
head = radixSort(head);
double clock2 = clock();
printf("排序完成:\n");
printf("排序时间: %f 秒\n", (double)(clock2 - clock1) / CLOCKS_PER_SEC);
return 0;
}

11
cs5/5_4/5_4.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_5_4</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
cs5/5_4/5_4.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5_4", "5_4.csproj", "{43F29EB3-99B5-4064-911E-3B3570272923}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{43F29EB3-99B5-4064-911E-3B3570272923}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43F29EB3-99B5-4064-911E-3B3570272923}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43F29EB3-99B5-4064-911E-3B3570272923}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43F29EB3-99B5-4064-911E-3B3570272923}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {20D2A0A1-A7D4-4CAC-BC03-AACF2D5F63B0}
EndGlobalSection
EndGlobal

60
cs5/5_4/Program.cs Normal file
View File

@@ -0,0 +1,60 @@
namespace _5_4
{
public abstract class Shape
{
protected string name;
public Shape(string name)
{
this.name = name;
}
public abstract void Show();
public abstract double Area();
}
public class Rectangle : Shape
{
protected double width;
protected double height;
public Rectangle(string name, double width, double height) : base(name)
{
this.width = width;
this.height = height;
}
public override void Show()
{
Console.WriteLine("Rectangle: {0} , area :{1}", name, width * height);
}
public override double Area()
{
return width * height;
}
}
public class Circle : Shape
{
protected double radius;
public Circle(string name, double radius) : base(name)
{
this.radius = radius;
}
public override void Show()
{
Console.WriteLine("Circle: {0} , area :{1}", name, Math.PI * radius * radius);
}
public override double Area()
{
return Math.PI * radius * radius;
}
}
public class Program
{
static void Main(string[] args)
{
Shape[] s = { new Rectangle("小矩形",1.0,2.0),
new Circle("大源",5.0),
};
foreach (Shape shape in s)
{
shape.Show();
}
}
}
}

11
cs5/5_5/5_5.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_5_5</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
cs5/5_5/5_5.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5_5", "5_5.csproj", "{C2EFCC00-2BDF-4E39-BBF1-FB54B8CB2708}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C2EFCC00-2BDF-4E39-BBF1-FB54B8CB2708}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2EFCC00-2BDF-4E39-BBF1-FB54B8CB2708}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2EFCC00-2BDF-4E39-BBF1-FB54B8CB2708}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2EFCC00-2BDF-4E39-BBF1-FB54B8CB2708}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {987BE462-C992-48BE-98EB-41564DDA8179}
EndGlobalSection
EndGlobal

46
cs5/5_5/Program.cs Normal file
View File

@@ -0,0 +1,46 @@
namespace _5_5
{
public struct Complex
{
public int real;
public int imag;
public Complex(int r, int i)
{
this.real = r;
this.imag = i;
}
public static Complex operator +(Complex c1, Complex c2)
{
return new Complex(c1.real + c2.real, c1.imag + c2.imag);
}
public static Complex operator -(Complex c1, Complex c2)
{
return new Complex(c1.real - c2.real, c1.imag - c2.imag);
}
public static Complex operator *(Complex c1, Complex c2)
{
return new Complex(c1.real * c2.real - c1.imag * c2.imag, c1.real * c2.imag + c1.imag * c2.real);
}
public override string ToString()
{
return (string.Format("{0}+{1}i", this.real, this.imag));
}
}
public class Program
{
static void Main(string[] args)
{
Complex c1 = new Complex(2, 3);
Complex c2 = new Complex(4, 5);
Complex sum = c1 + c2;
Complex diff = c1 - c2;
Complex prod = c1 * c2;
Console.WriteLine("第一个复数" + c1);
Console.WriteLine("第二个复数" + c2);
Console.WriteLine("复数的和" + sum);
Console.WriteLine("复数的差" + diff);
Console.WriteLine("复数的积" + prod);
Console.ReadKey();
}
}
}

11
cs5/5_6/5_6.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_5_6</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
cs5/5_6/5_6.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5_6", "5_6.csproj", "{93E19541-FEF3-4004-878B-615610904002}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{93E19541-FEF3-4004-878B-615610904002}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93E19541-FEF3-4004-878B-615610904002}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93E19541-FEF3-4004-878B-615610904002}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93E19541-FEF3-4004-878B-615610904002}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {49161CD3-DF8F-4571-A2D5-DDDC82BFFCC2}
EndGlobalSection
EndGlobal

61
cs5/5_6/Program.cs Normal file
View File

@@ -0,0 +1,61 @@
namespace _5_6
{
public interface ICDPlayer
{
void Play();
void Stop();
void PreviousTrack();
void NextTrack();
int CurrentTrack
{
get;
}
}
public class CDPlayer : ICDPlayer
{
private int currentTrack = 0;
public void Play()
{
Console.WriteLine("启动CD。。。");
}
public void Stop()
{
Console.WriteLine("停止播放CD。。。");
}
public void PreviousTrack()
{
if (currentTrack > 0)
{
currentTrack--;
}
Console.WriteLine("上一音轨:");
}
public void NextTrack()
{
Console.WriteLine("下一音轨:");
currentTrack++;
}
public int CurrentTrack
{
get
{
return currentTrack;
}
}
}
public class Program
{
static void Main(string[] args)
{
CDPlayer mycd = new CDPlayer();
mycd.Play();
Console.WriteLine("当前音轨:" + mycd.CurrentTrack);
mycd.NextTrack();
Console.WriteLine("当前音轨:" + mycd.CurrentTrack);
mycd.PreviousTrack();
Console.WriteLine("当前音轨:" + mycd.CurrentTrack);
mycd.Stop();
}
}
}

11
cs5/5_7/5_7.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>_5_7</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

25
cs5/5_7/5_7.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36616.10 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "5_7", "5_7.csproj", "{096FB123-18B3-4727-A914-48480106C798}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{096FB123-18B3-4727-A914-48480106C798}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{096FB123-18B3-4727-A914-48480106C798}.Debug|Any CPU.Build.0 = Debug|Any CPU
{096FB123-18B3-4727-A914-48480106C798}.Release|Any CPU.ActiveCfg = Release|Any CPU
{096FB123-18B3-4727-A914-48480106C798}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {02E74EAC-8A72-404C-B90C-C6C9BFD815B0}
EndGlobalSection
EndGlobal

53
cs5/5_7/Program.cs Normal file
View File

@@ -0,0 +1,53 @@
using System;
using System.Collections;
namespace _5_7
{
public class NameListEventArgs : EventArgs
{
public string Name { get; set; }
public int Count { get; set; }
public NameListEventArgs(string name, int count)
{
Name = name;
Count = count;
}
}
public delegate void NameListEventHandler(object source, NameListEventArgs e);
public class NameList
{
ArrayList list;
public event NameListEventHandler nameListEvent;
public NameList()
{
list = new ArrayList();
}
public void Add(string name)
{
list.Add(name);
if (nameListEvent != null)
{
nameListEvent(this, new NameListEventArgs(name, list.Count));
}
}
}
public class EventDemo
{
public static void Method1(object source, NameListEventArgs e)
{
Console.WriteLine("增加项目 {0}", e.Name);
}
public static void Method2(object source, NameListEventArgs e)
{
Console.WriteLine("当前项目总数 {0}", e.Count);
}
public static void Main()
{
NameList myList = new NameList();
myList.nameListEvent += new NameListEventHandler(Method1);
myList.nameListEvent += new NameListEventHandler(Method2);
myList.Add("张三");
myList.Add("李四");
myList.Add("王五");
}
}
}

192
lab/lab.cpp Normal file
View File

@@ -0,0 +1,192 @@
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
#define queuesize 10
#define maxvernum 8
typedef struct queue {
int elements[queuesize];
int front;
int rear;
} queue;
// 入队函数
int enQueue(queue* q, int value) {
if ((q->rear + 1) % queuesize == q->front) {
return FALSE;
}
q->elements[q->rear] = value;
q->rear = (q->rear + 1) % queuesize;
return TRUE;
}
// 出队函数
int deQueue(queue* q, int* value) {
if (q->front == q->rear) {
return FALSE;
}
*value = q->elements[q->front];
q->front = (q->front + 1) % queuesize;
return TRUE;
}
// 初始化队列
void initQueue(queue* q) {
q->front = 0;
q->rear = 0;
}
// 单链表节点定义
typedef struct Node {
int data;
struct Node* next;
} Node;
// 顶点结点(邻接表头)
typedef struct VexNode {
int vexnum;
Node* firstedge;
} VexNode;
// 邻接表
typedef struct AdjList {
VexNode adjlist[maxvernum];
int vexnum;
int edgenum;
} AdjList;
// 定位顶点值
int locateVex(AdjList* G, int v) {
for (int i = 0; i < G->vexnum; i++) {
if (G->adjlist[i].vexnum == v) {
return i;
}
}
return -1;
}
// 创建有向图
void Creategraph(AdjList* g) {
int i, k, v1, v2;
printf("请输入顶点数和边数(空格分隔)", maxvernum);
scanf_s("%d %d", &g->vexnum, &g->edgenum);
// 初始化顶点
for (i = 0; i < g->vexnum; i++) {
g->adjlist[i].vexnum = i + 1;
g->adjlist[i].firstedge = NULL;
}
printf("当前顶点为:");
for (i = 0; i < g->vexnum; i++) {
printf("v%d ", g->adjlist[i].vexnum);
}
printf("\n");
// 依次输入每条有向边(弧头 v1 -> 弧尾 v2用空格分隔
for (k = 0; k < g->edgenum; k++) {
printf("请输入第%d条有向边的弧头 和 弧尾(用空格分隔):", k + 1);
scanf_s("%d %d", &v1, &v2);
int i_idx = locateVex(g, v1);
int j_idx = locateVex(g, v2);
if (i_idx >= 0 && j_idx >= 0) {
// 在 v1 的链表末尾加入 v2
Node* bss = (Node*)malloc(sizeof(Node));
if (!bss) {
printf("内存分配失败");
return;
}
bss->data = v2;
bss->next = NULL;
if (g->adjlist[i_idx].firstedge == NULL) {
g->adjlist[i_idx].firstedge = bss;
}
else {
Node* q = g->adjlist[i_idx].firstedge;
while (q->next) q = q->next;
q->next = bss;
}
}
else {
printf("顶点 %d 或 %d 不存在,边被忽略\n", v1, v2);
}
}
// 输出邻接表
printf("输出各个顶点的邻接表:\n");
for (i = 0; i < g->vexnum; i++) {
printf("顶点 v%d", g->adjlist[i].vexnum);
Node* p = g->adjlist[i].firstedge;
while (p) {
printf(" --> v%d", p->data);
p = p->next;
}
printf("\n");
}
}
// 深度优先遍历
void DFS(AdjList* G, int v, int visited[]) {
int i = locateVex(G, v);
visited[i] = 1;
printf("%d ", G->adjlist[i].vexnum);
Node* p = G->adjlist[i].firstedge;
while (p != NULL) {
int j = locateVex(G, p->data);
if (j != -1 && !visited[j]) {
DFS(G, p->data, visited);
}
p = p->next;
}
}
// 广度优先遍历
void BFS(AdjList* G, int v, int visited[]) {
queue q;
initQueue(&q);
int i = locateVex(G, v);
if (i == -1) return;
visited[i] = 1;
printf("%d ", G->adjlist[i].vexnum);
enQueue(&q, v);
int w;
while (deQueue(&q, &w)) {
int k = locateVex(G, w);
if (k == -1) continue;
Node* p = G->adjlist[k].firstedge;
while (p != NULL) {
int j = locateVex(G, p->data);
if (j != -1 && !visited[j]) {
visited[j] = 1;
printf("%d ", G->adjlist[j].vexnum);
enQueue(&q, p->data);
}
p = p->next;
}
}
}
int main() {
AdjList G;
Creategraph(&G);
int visited[maxvernum] = { 0 };
printf("深度优先遍历结果:");
for (int i = 0; i < G.vexnum; i++) {
if (!visited[i]) {
DFS(&G, G.adjlist[i].vexnum, visited);
}
}
printf("\n");
for (int i = 0; i < maxvernum; i++) visited[i] = 0;
printf("广度优先遍历结果:");
for (int i = 0; i < G.vexnum; i++) {
if (!visited[i]) {
BFS(&G, G.adjlist[i].vexnum, visited);
}
}
return 0;
}

31
lab/lab.sln Normal file
View File

@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab", "lab.vcxproj", "{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}.Debug|x64.ActiveCfg = Debug|x64
{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}.Debug|x64.Build.0 = Debug|x64
{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}.Debug|x86.ActiveCfg = Debug|Win32
{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}.Debug|x86.Build.0 = Debug|Win32
{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}.Release|x64.ActiveCfg = Release|x64
{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}.Release|x64.Build.0 = Release|x64
{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}.Release|x86.ActiveCfg = Release|Win32
{5D999FD0-2593-4479-ADDA-A7FAAEFDF13E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AD21B75E-63D4-4614-872B-9EBA69D211F0}
EndGlobalSection
EndGlobal

131
lab/lab.vcxproj Normal file
View File

@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{5d999fd0-2593-4479-adda-a7faaefdf13e}</ProjectGuid>
<RootNamespace>lab</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="lab.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

22
lab/lab.vcxproj.filters Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="lab.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

159
shiyan3/shiyan3.cpp Normal file
View File

@@ -0,0 +1,159 @@
#include<stdio.h>
#include<stdlib.h>
typedef struct Tree {
char data;
struct Tree *lchild;
struct Tree *rchild;
} Tree;
// 初始化树
void initTree(Tree *T) {
T->lchild = NULL;
T->rchild = NULL;
T->data = '0';
}
// 创建树
void CreateTree(Tree* T) {
int n = 0, m = 0, i = 0;
if (T->data == '0') {
printf("请输入该子树根节点的数据:");
//getchar();
//char x;
scanf_s("%c", &T->data);
getchar();
}
printf("节点%c是否有左子树0没有1:", T->data);
scanf_s("%d", &n);
getchar();
if (n == 1) {
Tree* lchild = (Tree*)malloc(sizeof(Tree));
T->lchild = lchild;
lchild->lchild = NULL;
lchild->rchild = NULL;
lchild->data = '0';
CreateTree(T->lchild);
printf("该节点%c是否存在右子树0没有 1", T->data);
scanf_s("%d", &i);
getchar();
if (i == 1) {
Tree* rchild = (Tree*)malloc(sizeof(Tree));
T->rchild = rchild;
rchild->lchild = NULL;
rchild->rchild = NULL;
rchild->data = '0';
CreateTree(T->rchild);
}
}
else if (n == 0) {
printf("节点%c是否有右子树0没有1:", T->data);
scanf_s("%d", &m);
getchar();
if (m == 1) {
Tree* rchild = (Tree*)malloc(sizeof(Tree));
T->rchild = rchild;
rchild->lchild = NULL;
rchild->rchild = NULL;
rchild->data = '0';
CreateTree(T->rchild);
}
}
}
// 中序遍历
void LDR(Tree *T) {
if (T != NULL) {
LDR(T->lchild);
printf("%c ", T->data);
LDR(T->rchild);
}
}
// 先序遍历
void DLR(Tree *T) {
if (T != NULL) {
printf("%c ", T->data);
DLR(T->lchild);
DLR(T->rchild);
}
}
// 后序遍历
void LRD(Tree *T) {
if (T != NULL) {
LRD(T->lchild);
LRD(T->rchild);
printf("%c ", T->data);
}
}
// 计算叶子节点个数
int leaves(Tree *T) {
int count = 0;
if (T == NULL) {
return 0;
}
if (T->lchild == NULL && T->rchild == NULL) {
count ++;
} else {
return leaves(T->lchild) + leaves(T->rchild);
}
return count;
}
// 计算树的深度
int depth(Tree *T) {
int ldepth = 0, rdepth = 0;
if (T == NULL) {
return 0;
} else {
ldepth = depth(T->lchild);
rdepth = depth(T->rchild);
return (ldepth > rdepth) ? (ldepth + 1) : (rdepth + 1);
}
}
// 计算树的节点个数
int nodes(Tree *T) {
if (T == NULL) {
return 0;
} else {
return nodes(T->lchild) + nodes(T->rchild) + 1;
}
}
// 计算度为2的节点个数
int degree2nodes(Tree *T) {
int count = 0;
if (T == NULL) {
return 0;
}
if (T->lchild != NULL && T->rchild != NULL) {
count ++;
}
return count + degree2nodes(T->lchild) + degree2nodes(T->rchild);
}
int main() {
Tree bss;
initTree(&bss);
CreateTree(&bss);
printf("中序遍历结果为:\n");
LDR(&bss);
printf("\n先序遍历结果为:\n");
DLR(&bss);
printf("\n后序遍历结果为:\n");
LRD(&bss);
printf("\n叶子节点个数为:%d\n", leaves(&bss));
printf("树的深度为:%d\n", depth(&bss));
printf("树的节点个数为:%d\n", nodes(&bss));
printf("度为2的节点个数为%d\n", degree2nodes(&bss));
return 0;
}

31
shiyan3/shiyan3.sln Normal file
View File

@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shiyan3", "shiyan3.vcxproj", "{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}.Debug|x64.ActiveCfg = Debug|x64
{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}.Debug|x64.Build.0 = Debug|x64
{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}.Debug|x86.ActiveCfg = Debug|Win32
{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}.Debug|x86.Build.0 = Debug|Win32
{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}.Release|x64.ActiveCfg = Release|x64
{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}.Release|x64.Build.0 = Release|x64
{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}.Release|x86.ActiveCfg = Release|Win32
{EDB604AC-AC4B-44E1-9CC6-94E4D3B90D25}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B9410CB9-2A4A-4538-BEB4-3EE6716DD001}
EndGlobalSection
EndGlobal

131
shiyan3/shiyan3.vcxproj Normal file
View File

@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{edb604ac-ac4b-44e1-9cc6-94e4d3b90d25}</ProjectGuid>
<RootNamespace>shiyan3</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="shiyan3.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="shiyan3.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>

159
shiyan3/作业7.cpp Normal file
View File

@@ -0,0 +1,159 @@
#include<stdio.h>
#include<stdlib.h>
typedef struct Tree {
char data;
struct Tree *lchild;
struct Tree *rchild;
} Tree;
// 初始化树
void initTree(Tree *T) {
T->lchild = NULL;
T->rchild = NULL;
T->data = '0';
}
// 创建树
void CreateTree(Tree* T) {
int n = 0, m = 0, i = 0;
if (T->data == '0') {
printf("请输入该子树根节点的数据:");
//getchar();
//char x;
scanf_s("%c", &T->data);
getchar();
}
printf("节点%c是否有左子树0没有1:", T->data);
scanf_s("%d", &n);
getchar();
if (n == 1) {
Tree* lchild = (Tree*)malloc(sizeof(Tree));
T->lchild = lchild;
lchild->lchild = NULL;
lchild->rchild = NULL;
lchild->data = '0';
CreateTree(T->lchild);
printf("该节点%c是否存在右子树0没有 1", T->data);
scanf_s("%d", &i);
getchar();
if (i == 1) {
Tree* rchild = (Tree*)malloc(sizeof(Tree));
T->rchild = rchild;
rchild->lchild = NULL;
rchild->rchild = NULL;
rchild->data = '0';
CreateTree(T->rchild);
}
}
else if (n == 0) {
printf("节点%c是否有右子树0没有1:", T->data);
scanf_s("%d", &m);
getchar();
if (m == 1) {
Tree* rchild = (Tree*)malloc(sizeof(Tree));
T->rchild = rchild;
rchild->lchild = NULL;
rchild->rchild = NULL;
rchild->data = '0';
CreateTree(T->rchild);
}
}
}
// 中序遍历
void LDR(Tree *T) {
if (T != NULL) {
LDR(T->lchild);
printf("%c ", T->data);
LDR(T->rchild);
}
}
// 先序遍历
void DLR(Tree *T) {
if (T != NULL) {
printf("%c ", T->data);
DLR(T->lchild);
DLR(T->rchild);
}
}
// 后序遍历
void LRD(Tree *T) {
if (T != NULL) {
LRD(T->lchild);
LRD(T->rchild);
printf("%c ", T->data);
}
}
// 计算叶子节点个数
int leaves(Tree *T) {
int count = 0;
if (T == NULL) {
return 0;
}
if (T->lchild == NULL && T->rchild == NULL) {
count ++;
} else {
return leaves(T->lchild) + leaves(T->rchild);
}
return count;
}
// 计算树的深度
int depth(Tree *T) {
int ldepth = 0, rdepth = 0;
if (T == NULL) {
return 0;
} else {
ldepth = depth(T->lchild);
rdepth = depth(T->rchild);
return (ldepth > rdepth) ? (ldepth + 1) : (rdepth + 1);
}
}
// 计算树的节点个数
int nodes(Tree *T) {
if (T == NULL) {
return 0;
} else {
return nodes(T->lchild) + nodes(T->rchild) + 1;
}
}
// 计算度为2的节点个数
int degree2nodes(Tree *T) {
int count = 0;
if (T == NULL) {
return 0;
}
if (T->lchild != NULL && T->rchild != NULL) {
count ++;
}
return count + degree2nodes(T->lchild) + degree2nodes(T->rchild);
}
int main() {
Tree bss;
initTree(&bss);
CreateTree(&bss);
printf("中序遍历结果为:\n");
LDR(&bss);
printf("\n先序遍历结果为:\n");
DLR(&bss);
printf("\n后序遍历结果为:\n");
LRD(&bss);
printf("\n叶子节点个数为:%d\n", leaves(&bss));
printf("树的深度为:%d\n", depth(&bss));
printf("树的节点个数为:%d\n", nodes(&bss));
printf("度为2的节点个数为%d\n", degree2nodes(&bss));
return 0;
}