diff options
| author | Chanin Timbal <[email protected]> | 2024-05-31 17:00:30 -0700 |
|---|---|---|
| committer | Chanin Timbal <[email protected]> | 2024-05-31 17:00:30 -0700 |
| commit | abd25f91c773ba9fc3584441aee386e90110b845 (patch) | |
| tree | e29517b26e47f245be2f07d9e27c1cd10a7a971e | |
| parent | Purged all previous commits and reset Repo (diff) | |
| parent | wrote some code for the encoding function in the helper file (diff) | |
| download | homework-1-chaninnohea-abd25f91c773ba9fc3584441aee386e90110b845.tar.xz homework-1-chaninnohea-abd25f91c773ba9fc3584441aee386e90110b845.zip | |
Merge branch 'develop' of https://github.com/OIT-WI-2024/homework-1-chaninnohea into develop
| -rw-r--r-- | CST 126/CST_126.sln | 11 | ||||
| -rw-r--r-- | CST 126/Homework 1/bitwise_operators.cpp | 35 | ||||
| -rw-r--r-- | CST 126/Homework 2/Homework2/Base64Converter.hpp | 19 | ||||
| -rw-r--r-- | CST 126/Homework 2/Homework2/helpers.hpp | 2 |
4 files changed, 63 insertions, 4 deletions
diff --git a/CST 126/CST_126.sln b/CST 126/CST_126.sln index 91644a9..fe04bb4 100644 --- a/CST 126/CST_126.sln +++ b/CST 126/CST_126.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework 1", "Homework 1\Homework 1.vcxproj", "{63480B39-FB46-498B-A592-F4EAAF597F78}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "In-Class", "In-Class\In-Class.vcxproj", "{4447AFE1-22A8-48A1-BF74-2191012CBD74}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -14,13 +16,20 @@ Global EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {63480B39-FB46-498B-A592-F4EAAF597F78}.Debug|x64.ActiveCfg = Debug|x64 - {63480B39-FB46-498B-A592-F4EAAF597F78}.Debug|x64.Build.0 = Debug|x64 {63480B39-FB46-498B-A592-F4EAAF597F78}.Debug|x86.ActiveCfg = Debug|Win32 {63480B39-FB46-498B-A592-F4EAAF597F78}.Debug|x86.Build.0 = Debug|Win32 {63480B39-FB46-498B-A592-F4EAAF597F78}.Release|x64.ActiveCfg = Release|x64 {63480B39-FB46-498B-A592-F4EAAF597F78}.Release|x64.Build.0 = Release|x64 {63480B39-FB46-498B-A592-F4EAAF597F78}.Release|x86.ActiveCfg = Release|Win32 {63480B39-FB46-498B-A592-F4EAAF597F78}.Release|x86.Build.0 = Release|Win32 + {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Debug|x64.ActiveCfg = Debug|x64 + {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Debug|x64.Build.0 = Debug|x64 + {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Debug|x86.ActiveCfg = Debug|Win32 + {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Debug|x86.Build.0 = Debug|Win32 + {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Release|x64.ActiveCfg = Release|x64 + {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Release|x64.Build.0 = Release|x64 + {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Release|x86.ActiveCfg = Release|Win32 + {4447AFE1-22A8-48A1-BF74-2191012CBD74}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CST 126/Homework 1/bitwise_operators.cpp b/CST 126/Homework 1/bitwise_operators.cpp new file mode 100644 index 0000000..65bb509 --- /dev/null +++ b/CST 126/Homework 1/bitwise_operators.cpp @@ -0,0 +1,35 @@ +//Bitwise Operators +#include <bitset> +#include <iostream> +#include <iomanip> + +using std::cout; +using std::cin; +using std::endl; +using std::bitset; + +int main(const int argc, char* argv[]) +{ + + int num = 0xABCD; + int mask = 0xFFF0; + int result = num & mask; + + bitset<16> binary_num(0x03); + bitset<16> binary_mask(0x03); + bitset<16> binary_result(0x03); + + cout << "Hex:\n"; + cout << "num = " << "0x" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << num << endl; + cout << "mask = " << "0x" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << num << endl; + cout << "result = " << "0x" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << num << endl; + + + cout << "Binary:\n"; + cout << binary_num << endl; + cout << binary_mask << endl; + cout << binary_result << endl; + + + return true; +}
\ No newline at end of file diff --git a/CST 126/Homework 2/Homework2/Base64Converter.hpp b/CST 126/Homework 2/Homework2/Base64Converter.hpp index 704079b..36e55e4 100644 --- a/CST 126/Homework 2/Homework2/Base64Converter.hpp +++ b/CST 126/Homework 2/Homework2/Base64Converter.hpp @@ -1,10 +1,25 @@ #ifndef BASE64_CONVERTER_HPP #define BASE64_CONVERTER_HPP +char characterMap[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', +'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', +'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', +'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', +'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '/', '+'}; -//encode -//decode +inline char* Base64Encode(char* buffer, size_t& size) +{ + + + + + + + + + +} #endif
\ No newline at end of file diff --git a/CST 126/Homework 2/Homework2/helpers.hpp b/CST 126/Homework 2/Homework2/helpers.hpp index 0aa6251..e448cc9 100644 --- a/CST 126/Homework 2/Homework2/helpers.hpp +++ b/CST 126/Homework 2/Homework2/helpers.hpp @@ -8,7 +8,7 @@ inline char* ReadTextFromFile(const char* fileName, char* buffer) return buffer; } -inline char* ReadFileAsBinary(const char* fileName, char* buffer) +inline char* ReadFileAsBinary(const char* fileName, char* buffer, size_t& size) { try { |