统一归档20260319
This commit is contained in:
11
CS/lab10/10_4/10_4.csproj
Normal file
11
CS/lab10/10_4/10_4.csproj
Normal file
@@ -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>
|
||||
25
CS/lab10/10_4/10_4.sln
Normal file
25
CS/lab10/10_4/10_4.sln
Normal file
@@ -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
|
||||
24
CS/lab10/10_4/Program.cs
Normal file
24
CS/lab10/10_4/Program.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
CS/lab10/10_4/屏幕截图 2025-11-28 164906.png
Normal file
BIN
CS/lab10/10_4/屏幕截图 2025-11-28 164906.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
Reference in New Issue
Block a user