This commit is contained in:
Scott Lahteine 2018-01-11 22:15:01 -06:00
parent 84de428d30
commit 742cff5f3c
2 changed files with 24 additions and 24 deletions

View file

@ -92,38 +92,38 @@ public:
void print(const char value[]) {
printf("%s" , value);
}
void print(char value, int nbase = BYTE) {
void print(char value, int nbase = 0) {
if (nbase == BIN) print_bin(value,8);
else if (nbase == OCT) printf("%3o", value);
else if (nbase == HEX) printf("%2X", value);
else if (nbase == DEC ) printf("%d", value);
else printf("%c" , value);
}
void print(unsigned char value, int nbase = BYTE) {
void print(unsigned char value, int nbase = 0) {
if (nbase == BIN) print_bin(value,8);
else if (nbase == OCT) printf("%3o", value);
else if (nbase == HEX) printf("%2X", value);
else printf("%u" , value);
}
void print(int value, int nbase = BYTE) {
void print(int value, int nbase = 0) {
if (nbase == BIN) print_bin(value,16);
else if (nbase == OCT) printf("%6o", value);
else if (nbase == HEX) printf("%4X", value);
else printf("%d", value);
}
void print(unsigned int value, int nbase = BYTE) {
void print(unsigned int value, int nbase = 0) {
if (nbase == BIN) print_bin(value,16);
else if (nbase == OCT) printf("%6o", value);
else if (nbase == HEX) printf("%4X", value);
else printf("%u" , value);
}
void print(long value, int nbase = BYTE) {
void print(long value, int nbase = 0) {
if (nbase == BIN) print_bin(value,32);
else if (nbase == OCT) printf("%11o", value);
else if (nbase == HEX) printf("%8X", value);
else printf("%ld" , value);
}
void print(unsigned long value, int nbase = BYTE) {
void print(unsigned long value, int nbase = 0) {
if (nbase == BIN) print_bin(value,32);
else if (nbase == OCT) printf("%11o", value);
else if (nbase == HEX) printf("%8X", value);
@ -141,27 +141,27 @@ public:
void println(const char value[]) {
printf("%s\n" , value);
}
void println(char value, int nbase = BYTE) {
void println(char value, int nbase = 0) {
print(value, nbase);
println();
}
void println(unsigned char value, int nbase = BYTE) {
void println(unsigned char value, int nbase = 0) {
print(value, nbase);
println();
}
void println(int value, int nbase = BYTE) {
void println(int value, int nbase = 0) {
print(value, nbase);
println();
}
void println(unsigned int value, int nbase = BYTE) {
void println(unsigned int value, int nbase = 0) {
print(value, nbase);
println();
}
void println(long value, int nbase = BYTE) {
void println(long value, int nbase = 0) {
print(value, nbase);
println();
}
void println(unsigned long value, int nbase = BYTE) {
void println(unsigned long value, int nbase = 0) {
print(value, nbase);
println();
}

View file

@ -142,38 +142,38 @@ public:
}
void print(const char value[]) { printf("%s" , value); }
void print(char value, int nbase = BYTE) {
void print(char value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 8);
else if (nbase == OCT) printf("%3o", value);
else if (nbase == HEX) printf("%2X", value);
else if (nbase == DEC ) printf("%d", value);
else printf("%c" , value);
}
void print(unsigned char value, int nbase = BYTE) {
void print(unsigned char value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 8);
else if (nbase == OCT) printf("%3o", value);
else if (nbase == HEX) printf("%2X", value);
else printf("%u" , value);
}
void print(int value, int nbase = BYTE) {
void print(int value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 16);
else if (nbase == OCT) printf("%6o", value);
else if (nbase == HEX) printf("%4X", value);
else printf("%d", value);
}
void print(unsigned int value, int nbase = BYTE) {
void print(unsigned int value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 16);
else if (nbase == OCT) printf("%6o", value);
else if (nbase == HEX) printf("%4X", value);
else printf("%u" , value);
}
void print(long value, int nbase = BYTE) {
void print(long value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 32);
else if (nbase == OCT) printf("%11o", value);
else if (nbase == HEX) printf("%8X", value);
else printf("%ld" , value);
}
void print(unsigned long value, int nbase = BYTE) {
void print(unsigned long value, int nbase = 0) {
if (nbase == BIN) print_bin(value, 32);
else if (nbase == OCT) printf("%11o", value);
else if (nbase == HEX) printf("%8X", value);
@ -183,12 +183,12 @@ public:
void print(double value, int round = 6) { printf("%f" , value); }
void println(const char value[]) { printf("%s\n" , value); }
void println(char value, int nbase = BYTE) { print(value, nbase); println(); }
void println(unsigned char value, int nbase = BYTE) { print(value, nbase); println(); }
void println(int value, int nbase = BYTE) { print(value, nbase); println(); }
void println(unsigned int value, int nbase = BYTE) { print(value, nbase); println(); }
void println(long value, int nbase = BYTE) { print(value, nbase); println(); }
void println(unsigned long value, int nbase = BYTE) { print(value, nbase); println(); }
void println(char value, int nbase = 0) { print(value, nbase); println(); }
void println(unsigned char value, int nbase = 0) { print(value, nbase); println(); }
void println(int value, int nbase = 0) { print(value, nbase); println(); }
void println(unsigned int value, int nbase = 0) { print(value, nbase); println(); }
void println(long value, int nbase = 0) { print(value, nbase); println(); }
void println(unsigned long value, int nbase = 0) { print(value, nbase); println(); }
void println(float value, int round = 6) { printf("%f\n" , value); }
void println(double value, int round = 6) { printf("%f\n" , value); }
void println(void) { print('\n'); }