1
0

Finished Day 2 Part 2

This commit is contained in:
2021-12-03 23:08:16 -05:00
parent e6dafb4daa
commit 2162f8a646
4 changed files with 1045 additions and 0 deletions
+4
View File
@@ -10,6 +10,7 @@ int main()
int horizontal = 0;
int vertical = 0;
int aim = 0;
if(!input.is_open())
{
@@ -23,14 +24,17 @@ int main()
if (movement == "forward")
{
horizontal += stoi(line.substr(line.find(" ")));
vertical += aim * stoi(line.substr(line.find(" ")));
}
else if (movement == "up")
{
vertical -= stoi(line.substr(line.find(" ")));
aim -= stoi(line.substr(line.find(" ")));
}
else
{
vertical += stoi(line.substr(line.find(" ")));
aim += stoi(line.substr(line.find(" ")));
}
}