Реализована функция print_in_hex
Этот коммит содержится в:
@@ -28,8 +28,20 @@ void test_nibbles() {
|
|||||||
cout << "Nibble extraction tests passed!\n";
|
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() {
|
int main() {
|
||||||
test_nibble_to_hex();
|
test_nibble_to_hex();
|
||||||
test_nibbles();
|
test_nibbles();
|
||||||
|
test_print_in_hex();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user