From 1575441b495bc6c8095c46c6fbae80441cf23fab Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 9 Apr 2018 21:27:20 +0200 Subject: [PATCH] soviel dazu --- 02_MENT/main_02_MENT.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/02_MENT/main_02_MENT.cpp b/02_MENT/main_02_MENT.cpp index 53d7571..196eedc 100644 --- a/02_MENT/main_02_MENT.cpp +++ b/02_MENT/main_02_MENT.cpp @@ -42,7 +42,6 @@ void printPascalString(PascalString s) { } PascalString intToDual(int n) { - int i = std::to_string(n).length() * 4; PascalString string = {i}; while(n >= 1) { @@ -54,8 +53,17 @@ PascalString intToDual(int n) { } char intToHexChar(int n) { - if(n < 9) { switch(n) { + case 0: return '0'; + case 1: return '1'; + case 2: return '2'; + case 3: return '3'; + case 4: return '4'; + case 5: return '5'; + case 6: return '6'; + case 7: return '7'; + case 8: return '8'; + case 9: return '9'; case 10: return 'A'; case 11: return 'B'; case 12: return 'C'; @@ -64,8 +72,6 @@ char intToHexChar(int n) { case 15: return 'F'; default: return 'X'; } - } - else return n + '0'; } PascalString intToHex(int n) {