aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2023-12-01 21:37:56 +0100
committerThomas Schmucker <ts@its1.de>2023-12-01 21:37:56 +0100
commit3b9678982f745acf5f94f88ac6e4eb9cb824a806 (patch)
tree404cc1afc8d9dc5ec190624c7c71321c658ca928
parent9a164c3f65c01e31a9d1a8578e29b358972ddfed (diff)
downloadadvent-of-code-3b9678982f745acf5f94f88ac6e4eb9cb824a806.tar.gz
advent-of-code-3b9678982f745acf5f94f88ac6e4eb9cb824a806.tar.bz2
advent-of-code-3b9678982f745acf5f94f88ac6e4eb9cb824a806.zip
Aufräumen
-rw-r--r--makefile5
-rw-r--r--src/01b.cpp14
2 files changed, 2 insertions, 17 deletions
diff --git a/makefile b/makefile
index 69242b1..3facda7 100644
--- a/makefile
+++ b/makefile
@@ -2,10 +2,7 @@ include config.mk
2 2
3all: bin/01a bin/01b 3all: bin/01a bin/01b
4 4
5bin/01a: obj/01a.o | bin 5bin/%: obj/%.o | bin
6 c++ $(LDFLAGS) $^ -o $@
7
8bin/01b: obj/01b.o | bin
9 c++ $(LDFLAGS) $^ -o $@ 6 c++ $(LDFLAGS) $^ -o $@
10 7
11obj/%.o: src/%.cpp | obj 8obj/%.o: src/%.cpp | obj
diff --git a/src/01b.cpp b/src/01b.cpp
index f87da3a..91ba7b7 100644
--- a/src/01b.cpp
+++ b/src/01b.cpp
@@ -6,18 +6,6 @@
6#include <vector> 6#include <vector>
7using namespace std; 7using namespace std;
8 8
9string
10replace_all(string str, const string search, const string with)
11{
12 for ( ;; ) {
13 auto it = str.find(search);
14 if ( it == string::npos )
15 break;
16 str.replace(it, search.length(), with);
17 }
18 return str;
19}
20
21int 9int
22main() 10main()
23{ 11{
@@ -45,7 +33,7 @@ main()
45 33
46 fstream input{ "data/01a.txt" }; 34 fstream input{ "data/01a.txt" };
47 35
48 int sum = 0; 36 auto sum = 0;
49 for ( string line; input >> line; ) { 37 for ( string line; input >> line; ) {
50 string sub; 38 string sub;
51 vector<int> digits; 39 vector<int> digits;