From 79e8d6910040574c217c9bde335e2a0e67a3ab1d Mon Sep 17 00:00:00 2001 From: Fox Jovic Date: Thu, 9 Jul 2026 13:21:49 -0700 Subject: [PATCH 1/2] INITIAL COMMIT Added by decimal converter(the name is a little misleading on what it actually does) --- binary-converter/main.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 binary-converter/main.cpp diff --git a/binary-converter/main.cpp b/binary-converter/main.cpp new file mode 100644 index 0000000..f695946 --- /dev/null +++ b/binary-converter/main.cpp @@ -0,0 +1,35 @@ +#include +#include +#include + + + + + + +int main() { + int target = 70; //4 bytes + bool first; //1 byte + int cur_total = 0; + std::vector byte_sizes = {128,64,32,16,8,4,2,1}; //32 bytes + std::vector saved_indices(8,0); //32 bytes + + //temp + for (size_t i{}; i < byte_sizes.size(); ++i) { + if (cur_total + byte_sizes[i] <= target) { + saved_indices[i] = 1; + cur_total += byte_sizes[i]; + } + } + + std::cout << target << "\n"; + for (auto i : saved_indices) { + std::cout << i; + } + std::cout << "\n"; + std:: cout << static_cast(target) << "\n"; + +} + + + From f03f6b6ef21c67f9f984841dd464aadd941572e9 Mon Sep 17 00:00:00 2001 From: Fox Jovic Date: Thu, 9 Jul 2026 13:22:25 -0700 Subject: [PATCH 2/2] Rename main.cpp to main.cpp --- {binary-converter => decimal-to-binary}/main.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {binary-converter => decimal-to-binary}/main.cpp (100%) diff --git a/binary-converter/main.cpp b/decimal-to-binary/main.cpp similarity index 100% rename from binary-converter/main.cpp rename to decimal-to-binary/main.cpp