This commit is contained in:
Geir Okkenhaug Jerstad 2025-01-02 10:39:51 +01:00
parent 905305ef0d
commit c00065c1bc
13 changed files with 176 additions and 7 deletions

16
Emne 3/Debug1/Debug1.sln Normal file
View file

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debug1", "Debug1\Debug1.csproj", "{9A30B79C-FF6E-40AC-AE3C-BB49F525540F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9A30B79C-FF6E-40AC-AE3C-BB49F525540F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A30B79C-FF6E-40AC-AE3C-BB49F525540F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A30B79C-FF6E-40AC-AE3C-BB49F525540F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A30B79C-FF6E-40AC-AE3C-BB49F525540F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

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,21 @@
var range = 250;
var counts = new int[range];
string text = "something";
while (!string.IsNullOrWhiteSpace(text))
{
text = Console.ReadLine();
foreach (var character in text ?? string.Empty )
{
counts[(int)character]++;
}
for (var i = 0; i < range; i++)
{
if (counts[i] > 0)
{
var character = (char)i;
Console.WriteLine(character + " - " + counts[i]);
}
}
}