Day 1 Part 1

This commit is contained in:
2023-12-01 13:14:26 -05:00
commit f67dea67c6
5 changed files with 1470 additions and 0 deletions

33
day1/part1/Program.cs Normal file
View File

@@ -0,0 +1,33 @@
namespace part1;
class Program
{
static void Main(string[] args)
{
int sum = 0;
string letters = "abcdefghijklmnopqrstuvwxyz";
StreamReader sr = new StreamReader("input");
String line = sr.ReadLine();
//Continue to read until you reach end of file
while (line != null)
{
line = line.ToLower();
foreach(char letter in letters) {
line = line.Replace(letter.ToString(), string.Empty);
}
sum += Int32.Parse(line[0].ToString()) * 10;
sum += Int32.Parse(line.Last().ToString());
Console.WriteLine($"Line: {line} - Sum: {sum}");
line = sr.ReadLine();
}
//close the file
sr.Close();
Console.WriteLine($"Total Sum: {sum}");
}
}

1000
day1/part1/input Normal file

File diff suppressed because it is too large Load Diff

14
day1/part1/part1.csproj Normal file
View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Update="input" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

25
day1/part1/part1.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "part1", "part1.csproj", "{C09F35B1-BEBD-40E5-A3A9-21C31B5142F8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C09F35B1-BEBD-40E5-A3A9-21C31B5142F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C09F35B1-BEBD-40E5-A3A9-21C31B5142F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C09F35B1-BEBD-40E5-A3A9-21C31B5142F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C09F35B1-BEBD-40E5-A3A9-21C31B5142F8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D4410252-496A-49DA-8EF3-4B0141DE8941}
EndGlobalSection
EndGlobal