diff --git a/lab04_LitvinovaAnna/Task1/Task1.vcxproj b/lab04_LitvinovaAnna/Task1/Task1.vcxproj new file mode 100644 index 0000000..8ecfbad --- /dev/null +++ b/lab04_LitvinovaAnna/Task1/Task1.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {254a6f64-8e28-488f-8613-20f2126ad995} + Task1 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + + + \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task1/Task1.vcxproj.filters b/lab04_LitvinovaAnna/Task1/Task1.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/lab04_LitvinovaAnna/Task1/Task1.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task1/main.cpp b/lab04_LitvinovaAnna/Task1/main.cpp new file mode 100644 index 0000000..9ee8fbf --- /dev/null +++ b/lab04_LitvinovaAnna/Task1/main.cpp @@ -0,0 +1,62 @@ +#include +#include +#include + +// hex (lowercase) +static char to_hex_digit(uint8_t nibble) { + assert(nibble < 16); + constexpr char digits[] = "0123456789abcdef"; + return digits[nibble]; +} + +// hex ( ) +void print_in_hex(uint8_t byte) { + std::cout << to_hex_digit(byte >> 4) << to_hex_digit(byte & 0x0F); +} + +// hex, , 16 +void print_in_hex(const void* data, size_t size) { + const auto* bytes = static_cast(data); + for (size_t i = 0; i < size; ++i) { + print_in_hex(bytes[i]); + if (i + 1 < size) { + std::cout << ' '; + if ((i + 1) % 16 == 0) std::cout << '\n'; + } + } +} + +// (8 ) +void print_in_binary(uint8_t byte) { + for (int bit = 7; bit >= 0; --bit) { + std::cout << (((byte >> bit) & 1) ? '1' : '0'); + } +} + +// , , 4 +void print_in_binary(const void* data, size_t size) { + const auto* bytes = static_cast(data); + for (size_t i = 0; i < size; ++i) { + print_in_binary(bytes[i]); + if (i + 1 < size) { + std::cout << ' '; + if ((i + 1) % 4 == 0) std::cout << '\n'; + } + } +} + +int main() { + // - hex- + assert(to_hex_digit(0) == '0'); + assert(to_hex_digit(10) == 'a'); + assert(to_hex_digit(15) == 'f'); + + // + uint32_t sample = 0x1234ABCD; + std::cout << "Hex dump:\n"; + print_in_hex(&sample, sizeof(sample)); + std::cout << "\n\nBinary dump:\n"; + print_in_binary(&sample, sizeof(sample)); + std::cout << '\n'; + return 0; +} \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task2/Task2.vcxproj b/lab04_LitvinovaAnna/Task2/Task2.vcxproj new file mode 100644 index 0000000..189c121 --- /dev/null +++ b/lab04_LitvinovaAnna/Task2/Task2.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {61a63668-1956-4d49-a546-3ed0d63e319d} + Task2 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + + + \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task2/Task2.vcxproj.filters b/lab04_LitvinovaAnna/Task2/Task2.vcxproj.filters new file mode 100644 index 0000000..e8deb3d --- /dev/null +++ b/lab04_LitvinovaAnna/Task2/Task2.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task2/main.cpp b/lab04_LitvinovaAnna/Task2/main.cpp new file mode 100644 index 0000000..8722294 --- /dev/null +++ b/lab04_LitvinovaAnna/Task2/main.cpp @@ -0,0 +1,73 @@ +#include +#include +#include + +// hex ( , ). +static void print_byte_hex(uint8_t byte) { + static const char digits[] = "0123456789ABCDEF"; + std::cout << digits[byte >> 4] << digits[byte & 0x0F]; +} + +// 2- hex ( , ). +static void print_hex_uint16(uint16_t value) { + const uint8_t* p = reinterpret_cast(&value); + print_byte_hex(p[0]); + std::cout << ' '; + print_byte_hex(p[1]); +} + +// . +static void print_byte_binary(uint8_t byte) { + for (int bit = 7; bit >= 0; --bit) { + std::cout << ((byte >> bit) & 1); + } +} + +// 2- ( ). +static void print_binary_uint16(uint16_t value) { + const uint8_t* p = reinterpret_cast(&value); + print_byte_binary(p[0]); + print_byte_binary(p[1]); +} + +int main() { + uint16_t lhs = 0; + uint16_t rhs = 0; + char op = 0; + + if (!(std::cin >> lhs >> op >> rhs)) { + std::cout << " \n"; + return 1; + } + + uint16_t result = 0; + switch (op) { + case '&': result = lhs & rhs; break; + case '|': result = lhs | rhs; break; + case '^': result = lhs ^ rhs; break; + default: + std::cout << ": &, |, ^\n"; + return 1; + } + + // + std::cout << lhs << ' ' << op << ' ' << rhs << '\n'; + + // Hex- + print_hex_uint16(lhs); + std::cout << ' ' << op << ' '; + print_hex_uint16(rhs); + std::cout << " = "; + print_hex_uint16(result); + std::cout << '\n'; + + // Binary- + print_binary_uint16(lhs); + std::cout << ' ' << op << '\n'; + print_binary_uint16(rhs); + std::cout << " =\n"; + print_binary_uint16(result); + std::cout << '\n'; + + return 0; +} \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task3/Task3.vcxproj b/lab04_LitvinovaAnna/Task3/Task3.vcxproj new file mode 100644 index 0000000..367703c --- /dev/null +++ b/lab04_LitvinovaAnna/Task3/Task3.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + 17.0 + Win32Proj + {9a241783-27b1-4832-b0a0-02e169b48d33} + Task3 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task3/Task3.vcxproj.filters b/lab04_LitvinovaAnna/Task3/Task3.vcxproj.filters new file mode 100644 index 0000000..432013a --- /dev/null +++ b/lab04_LitvinovaAnna/Task3/Task3.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task4/Task4.vcxproj b/lab04_LitvinovaAnna/Task4/Task4.vcxproj new file mode 100644 index 0000000..4db3710 --- /dev/null +++ b/lab04_LitvinovaAnna/Task4/Task4.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + 17.0 + Win32Proj + {3f2b2564-9891-47a8-ad90-5cf652d6717b} + Task4 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + \ No newline at end of file diff --git a/lab04_LitvinovaAnna/Task4/Task4.vcxproj.filters b/lab04_LitvinovaAnna/Task4/Task4.vcxproj.filters new file mode 100644 index 0000000..432013a --- /dev/null +++ b/lab04_LitvinovaAnna/Task4/Task4.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab04_LitvinovaAnna/lab04_LitvinovaAnna.sln b/lab04_LitvinovaAnna/lab04_LitvinovaAnna.sln new file mode 100644 index 0000000..895d5f9 --- /dev/null +++ b/lab04_LitvinovaAnna/lab04_LitvinovaAnna.sln @@ -0,0 +1,71 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36221.1 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab04_LitvinovaAnna", "lab04_LitvinovaAnna\lab04_LitvinovaAnna.vcxproj", "{0FB6B505-145B-4523-B9D9-DED380D293CD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task1", "Task1\Task1.vcxproj", "{254A6F64-8E28-488F-8613-20F2126AD995}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task2", "Task2\Task2.vcxproj", "{61A63668-1956-4D49-A546-3ED0D63E319D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task3", "Task3\Task3.vcxproj", "{9A241783-27B1-4832-B0A0-02E169B48D33}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Task4", "Task4\Task4.vcxproj", "{3F2B2564-9891-47A8-AD90-5CF652D6717B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0FB6B505-145B-4523-B9D9-DED380D293CD}.Debug|x64.ActiveCfg = Debug|x64 + {0FB6B505-145B-4523-B9D9-DED380D293CD}.Debug|x64.Build.0 = Debug|x64 + {0FB6B505-145B-4523-B9D9-DED380D293CD}.Debug|x86.ActiveCfg = Debug|Win32 + {0FB6B505-145B-4523-B9D9-DED380D293CD}.Debug|x86.Build.0 = Debug|Win32 + {0FB6B505-145B-4523-B9D9-DED380D293CD}.Release|x64.ActiveCfg = Release|x64 + {0FB6B505-145B-4523-B9D9-DED380D293CD}.Release|x64.Build.0 = Release|x64 + {0FB6B505-145B-4523-B9D9-DED380D293CD}.Release|x86.ActiveCfg = Release|Win32 + {0FB6B505-145B-4523-B9D9-DED380D293CD}.Release|x86.Build.0 = Release|Win32 + {254A6F64-8E28-488F-8613-20F2126AD995}.Debug|x64.ActiveCfg = Debug|x64 + {254A6F64-8E28-488F-8613-20F2126AD995}.Debug|x64.Build.0 = Debug|x64 + {254A6F64-8E28-488F-8613-20F2126AD995}.Debug|x86.ActiveCfg = Debug|Win32 + {254A6F64-8E28-488F-8613-20F2126AD995}.Debug|x86.Build.0 = Debug|Win32 + {254A6F64-8E28-488F-8613-20F2126AD995}.Release|x64.ActiveCfg = Release|x64 + {254A6F64-8E28-488F-8613-20F2126AD995}.Release|x64.Build.0 = Release|x64 + {254A6F64-8E28-488F-8613-20F2126AD995}.Release|x86.ActiveCfg = Release|Win32 + {254A6F64-8E28-488F-8613-20F2126AD995}.Release|x86.Build.0 = Release|Win32 + {61A63668-1956-4D49-A546-3ED0D63E319D}.Debug|x64.ActiveCfg = Debug|x64 + {61A63668-1956-4D49-A546-3ED0D63E319D}.Debug|x64.Build.0 = Debug|x64 + {61A63668-1956-4D49-A546-3ED0D63E319D}.Debug|x86.ActiveCfg = Debug|Win32 + {61A63668-1956-4D49-A546-3ED0D63E319D}.Debug|x86.Build.0 = Debug|Win32 + {61A63668-1956-4D49-A546-3ED0D63E319D}.Release|x64.ActiveCfg = Release|x64 + {61A63668-1956-4D49-A546-3ED0D63E319D}.Release|x64.Build.0 = Release|x64 + {61A63668-1956-4D49-A546-3ED0D63E319D}.Release|x86.ActiveCfg = Release|Win32 + {61A63668-1956-4D49-A546-3ED0D63E319D}.Release|x86.Build.0 = Release|Win32 + {9A241783-27B1-4832-B0A0-02E169B48D33}.Debug|x64.ActiveCfg = Debug|x64 + {9A241783-27B1-4832-B0A0-02E169B48D33}.Debug|x64.Build.0 = Debug|x64 + {9A241783-27B1-4832-B0A0-02E169B48D33}.Debug|x86.ActiveCfg = Debug|Win32 + {9A241783-27B1-4832-B0A0-02E169B48D33}.Debug|x86.Build.0 = Debug|Win32 + {9A241783-27B1-4832-B0A0-02E169B48D33}.Release|x64.ActiveCfg = Release|x64 + {9A241783-27B1-4832-B0A0-02E169B48D33}.Release|x64.Build.0 = Release|x64 + {9A241783-27B1-4832-B0A0-02E169B48D33}.Release|x86.ActiveCfg = Release|Win32 + {9A241783-27B1-4832-B0A0-02E169B48D33}.Release|x86.Build.0 = Release|Win32 + {3F2B2564-9891-47A8-AD90-5CF652D6717B}.Debug|x64.ActiveCfg = Debug|x64 + {3F2B2564-9891-47A8-AD90-5CF652D6717B}.Debug|x64.Build.0 = Debug|x64 + {3F2B2564-9891-47A8-AD90-5CF652D6717B}.Debug|x86.ActiveCfg = Debug|Win32 + {3F2B2564-9891-47A8-AD90-5CF652D6717B}.Debug|x86.Build.0 = Debug|Win32 + {3F2B2564-9891-47A8-AD90-5CF652D6717B}.Release|x64.ActiveCfg = Release|x64 + {3F2B2564-9891-47A8-AD90-5CF652D6717B}.Release|x64.Build.0 = Release|x64 + {3F2B2564-9891-47A8-AD90-5CF652D6717B}.Release|x86.ActiveCfg = Release|Win32 + {3F2B2564-9891-47A8-AD90-5CF652D6717B}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {69A615A4-A3AC-4F88-A327-C0C4CAC9D387} + EndGlobalSection +EndGlobal diff --git a/lab04_LitvinovaAnna/lab04_LitvinovaAnna/lab04_LitvinovaAnna.vcxproj b/lab04_LitvinovaAnna/lab04_LitvinovaAnna/lab04_LitvinovaAnna.vcxproj new file mode 100644 index 0000000..0c107da --- /dev/null +++ b/lab04_LitvinovaAnna/lab04_LitvinovaAnna/lab04_LitvinovaAnna.vcxproj @@ -0,0 +1,134 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + 17.0 + Win32Proj + {0fb6b505-145b-4523-b9d9-ded380d293cd} + lab04LitvinovaAnna + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + + + + diff --git a/lab04_LitvinovaAnna/lab04_LitvinovaAnna/lab04_LitvinovaAnna.vcxproj.filters b/lab04_LitvinovaAnna/lab04_LitvinovaAnna/lab04_LitvinovaAnna.vcxproj.filters new file mode 100644 index 0000000..153170c --- /dev/null +++ b/lab04_LitvinovaAnna/lab04_LitvinovaAnna/lab04_LitvinovaAnna.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + \ No newline at end of file