soviel dazu

This commit is contained in:
Johannes Theiner 2018-04-09 21:27:20 +02:00
parent c470912843
commit 1575441b49
1 changed files with 10 additions and 4 deletions

View File

@ -42,7 +42,6 @@ void printPascalString(PascalString s) {
} }
PascalString intToDual(int n) { PascalString intToDual(int n) {
int i = std::to_string(n).length() * 4; int i = std::to_string(n).length() * 4;
PascalString string = {i}; PascalString string = {i};
while(n >= 1) { while(n >= 1) {
@ -54,8 +53,17 @@ PascalString intToDual(int n) {
} }
char intToHexChar(int n) { char intToHexChar(int n) {
if(n < 9) {
switch(n) { 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 10: return 'A';
case 11: return 'B'; case 11: return 'B';
case 12: return 'C'; case 12: return 'C';
@ -64,8 +72,6 @@ char intToHexChar(int n) {
case 15: return 'F'; case 15: return 'F';
default: return 'X'; default: return 'X';
} }
}
else return n + '0';
} }
PascalString intToHex(int n) { PascalString intToHex(int n) {