diff options
| author | Thomas Schmucker <ts@its1.de> | 2023-12-01 21:37:56 +0100 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2023-12-01 21:37:56 +0100 |
| commit | 3b9678982f745acf5f94f88ac6e4eb9cb824a806 (patch) | |
| tree | 404cc1afc8d9dc5ec190624c7c71321c658ca928 | |
| parent | 9a164c3f65c01e31a9d1a8578e29b358972ddfed (diff) | |
| download | advent-of-code-3b9678982f745acf5f94f88ac6e4eb9cb824a806.tar.gz advent-of-code-3b9678982f745acf5f94f88ac6e4eb9cb824a806.tar.bz2 advent-of-code-3b9678982f745acf5f94f88ac6e4eb9cb824a806.zip | |
Aufräumen
| -rw-r--r-- | makefile | 5 | ||||
| -rw-r--r-- | src/01b.cpp | 14 |
2 files changed, 2 insertions, 17 deletions
| @@ -2,10 +2,7 @@ include config.mk | |||
| 2 | 2 | ||
| 3 | all: bin/01a bin/01b | 3 | all: bin/01a bin/01b |
| 4 | 4 | ||
| 5 | bin/01a: obj/01a.o | bin | 5 | bin/%: obj/%.o | bin |
| 6 | c++ $(LDFLAGS) $^ -o $@ | ||
| 7 | |||
| 8 | bin/01b: obj/01b.o | bin | ||
| 9 | c++ $(LDFLAGS) $^ -o $@ | 6 | c++ $(LDFLAGS) $^ -o $@ |
| 10 | 7 | ||
| 11 | obj/%.o: src/%.cpp | obj | 8 | obj/%.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> |
| 7 | using namespace std; | 7 | using namespace std; |
| 8 | 8 | ||
| 9 | string | ||
| 10 | replace_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 | |||
| 21 | int | 9 | int |
| 22 | main() | 10 | main() |
| 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; |
