统一归档20260319
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_10_1</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36717.8 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10_1", "10_1.csproj", "{AF3EAA9E-B0A4-4DDD-AD76-29F65FF546CC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AF3EAA9E-B0A4-4DDD-AD76-29F65FF546CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AF3EAA9E-B0A4-4DDD-AD76-29F65FF546CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AF3EAA9E-B0A4-4DDD-AD76-29F65FF546CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AF3EAA9E-B0A4-4DDD-AD76-29F65FF546CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {AE8A4792-903F-4B80-862F-2D95B7DEE3B6}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace _10_1
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
double a, b, c, p, h, area;
|
||||
Console.WriteLine("输入三角形的直角边A:");
|
||||
a = Convert.ToDouble(Console.ReadLine());
|
||||
Console.WriteLine("输入三角形的直角边B:");
|
||||
b = Convert.ToDouble(Console.ReadLine());
|
||||
c = Math.Sqrt(a * a + b * b);
|
||||
Console.WriteLine("直角三角形的三边分别为,a={0},b={1},c={2}");
|
||||
p = a + b + c;
|
||||
h = p / 2;
|
||||
area = Math.Sqrt(h * (h - a) * (h - b) * (h - c));
|
||||
Console.WriteLine("直角三角形的周长为{0},面积为:{1}", p, area);
|
||||
double sinA= a / c;
|
||||
double aAngel= Math.Asin(sinA) * 180 / Math.PI;
|
||||
double cosB= a / c;
|
||||
double bAngel= Math.Acos(cosB) * 180 / Math.PI;
|
||||
Console.WriteLine("直角三角形的角A为{0},角B为:{1}", aAngel, bAngel);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_10_2</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36717.8 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10_2", "10_2.csproj", "{0F5EF24A-118F-49CD-9A90-019285EB79A8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0F5EF24A-118F-49CD-9A90-019285EB79A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0F5EF24A-118F-49CD-9A90-019285EB79A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0F5EF24A-118F-49CD-9A90-019285EB79A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0F5EF24A-118F-49CD-9A90-019285EB79A8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3BA90027-911E-4AE7-8B9C-66DDE3494B4E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections;
|
||||
|
||||
namespace _10_2
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
ArrayList redballs = new ArrayList() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 };
|
||||
ArrayList blueballs = new ArrayList() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
|
||||
ArrayList redball = new ArrayList();
|
||||
Random randobj = new Random();
|
||||
int blueball=randobj.Next(1, 16);
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
int index = randobj.Next(0, redballs.Count);
|
||||
redball.Add(redballs[index]);
|
||||
redballs.RemoveAt(index);
|
||||
}
|
||||
Console.WriteLine("Red Balls:");
|
||||
foreach (var item in redball)
|
||||
{
|
||||
Console.Write(item + " ");
|
||||
}
|
||||
Console.WriteLine("\nBlue Ball:");
|
||||
Console.WriteLine(blueball);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_10_3</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36717.8 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10_3", "10_3.csproj", "{623C00AF-6FA2-4DA4-8EF6-1DFE6A08A215}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{623C00AF-6FA2-4DA4-8EF6-1DFE6A08A215}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{623C00AF-6FA2-4DA4-8EF6-1DFE6A08A215}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{623C00AF-6FA2-4DA4-8EF6-1DFE6A08A215}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{623C00AF-6FA2-4DA4-8EF6-1DFE6A08A215}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {CAE20878-4FEF-4790-B2CE-2FD71B7C534D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace _10_3
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
const string s4 = " ";
|
||||
int nYear = DateTime.Today.Year;
|
||||
for (int nMonth = 1; nMonth <= 12; nMonth++)
|
||||
{
|
||||
DateTime d1 = new DateTime(nYear, nMonth, 1);
|
||||
Console.WriteLine("{0}/{1}", d1.Year, d1.Month);
|
||||
Console.WriteLine("Su Mo Tu We Th Fr Sa");
|
||||
int iWeeks = (int)d1.DayOfWeek;
|
||||
int iLastDay = d1.AddMonths(1).AddDays(-1).Day;
|
||||
for (int i = 0; i < iWeeks; i++)
|
||||
{
|
||||
Console.Write(s4);
|
||||
}
|
||||
for (int iDay = 1; iDay <= iLastDay; iDay++)
|
||||
{
|
||||
Console.Write(" {0:00} ", iDay);
|
||||
if ((iDay + iWeeks) % 7 == 0)
|
||||
{
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_10_4</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36717.8 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10_4", "10_4.csproj", "{7B5F7831-4A32-4306-A181-F50BAEF293EF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7B5F7831-4A32-4306-A181-F50BAEF293EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7B5F7831-4A32-4306-A181-F50BAEF293EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7B5F7831-4A32-4306-A181-F50BAEF293EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7B5F7831-4A32-4306-A181-F50BAEF293EF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {30A7F968-1EBB-479E-AC0B-15B2A30CB02C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace _10_4
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string text = @"The quick brown fox jumps over the lazy dog." +
|
||||
@"An apple a day keeps the doctor away." +
|
||||
@"Can a fox and a dog be friends?";
|
||||
Console.WriteLine(text);
|
||||
string searchTerm = "the";
|
||||
string[] source = text.ToLower().Split(new char[] { '.', ' ','!','?','.' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
int wordCount = 0;
|
||||
foreach (string s in source)
|
||||
{
|
||||
if (s.CompareTo(searchTerm)==0)
|
||||
{
|
||||
wordCount++;
|
||||
}
|
||||
}
|
||||
Console.WriteLine("单词{0}一共出现{1}次,频率{2:#0.##%}",searchTerm,wordCount,wordCount/(double)source.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_10_5</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36717.8 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10_5", "10_5.csproj", "{9EA0C0C6-F83B-4049-A40D-51AE7D10CE24}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9EA0C0C6-F83B-4049-A40D-51AE7D10CE24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9EA0C0C6-F83B-4049-A40D-51AE7D10CE24}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9EA0C0C6-F83B-4049-A40D-51AE7D10CE24}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9EA0C0C6-F83B-4049-A40D-51AE7D10CE24}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {53828A45-60B9-499C-8249-C789F9952D9F}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Text;
|
||||
|
||||
namespace _10_5
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
bool bContinue = true;
|
||||
while (bContinue)
|
||||
{
|
||||
Console.Write("请输入英文单词:");
|
||||
string s =Console.ReadLine();
|
||||
if (s != "")
|
||||
{
|
||||
sb.Append(s);
|
||||
sb.Append(" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
bContinue = false;
|
||||
}
|
||||
}
|
||||
string str = sb.ToString();
|
||||
Console.WriteLine("共{0}字符,内容为{1}",sb.Length,str);
|
||||
string[] source = str.ToLower().Split(new char[] { '.', '?', '!', ':', ':', ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Array.Sort(source);
|
||||
foreach (string s in source) Console.WriteLine(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_10_6</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36717.8 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10_6", "10_6.csproj", "{F80AAAC0-0F05-41E5-B997-711801DF2CE6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F80AAAC0-0F05-41E5-B997-711801DF2CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F80AAAC0-0F05-41E5-B997-711801DF2CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F80AAAC0-0F05-41E5-B997-711801DF2CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F80AAAC0-0F05-41E5-B997-711801DF2CE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DA93D3A7-7043-403E-8699-6F103B98507C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace _10_6
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// 验证中国电话号码
|
||||
string pattern = @"(\^(\d{3}\ )|\d{3}-)?\d{8}$";
|
||||
Console.WriteLine("请输入字符串(中国电话号码)");
|
||||
string s = Console.ReadLine();
|
||||
bool b1 = Regex.IsMatch(s, pattern);
|
||||
Console.WriteLine("{0}是有效的中国电话号码吗? {1}", s, b1);
|
||||
// 验证邮政编码
|
||||
pattern = @"^\d{6}$";
|
||||
Console.WriteLine("请输入字符串(邮政编码)");
|
||||
s = Console.ReadLine();
|
||||
bool b2 = Regex.IsMatch(s, pattern);
|
||||
Console.WriteLine("{0}是有效的邮政编码吗? {1}", s, b2);
|
||||
// 有效URL地址
|
||||
pattern = @"^http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?$";
|
||||
Console.WriteLine("请输入字符串(URL地址)");
|
||||
s = Console.ReadLine();
|
||||
bool b3 = Regex.IsMatch(s, pattern);
|
||||
Console.WriteLine("{0}是有效的URL地址吗? {1}", s, b3);
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
Reference in New Issue
Block a user