From 89e33de9706204793156268df813281d58b38448 Mon Sep 17 00:00:00 2001 From: GorokhovDE <GorokhovDE@mpei.ru> Date: Mon, 23 Dec 2024 10:26:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20print=5Fin=5Fhex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab04/lab04.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lab04/lab04.cpp b/lab04/lab04.cpp index cc4e256..86de7aa 100644 --- a/lab04/lab04.cpp +++ b/lab04/lab04.cpp @@ -28,8 +28,20 @@ void test_nibbles() { cout << "Nibble extraction tests passed!\n"; } +void print_in_hex(uint8_t byte) { + cout << nibble_to_hex(high_nibble(byte)) + << nibble_to_hex(low_nibble(byte)); +} + +void test_print_in_hex() { + print_in_hex(0x0); cout << "\n"; + print_in_hex(0xab); cout << "\n"; + print_in_hex(0xff); cout << "\n"; +} + int main() { test_nibble_to_hex(); test_nibbles(); + test_print_in_hex(); return 0; }