From e60128b83b5efba31b9a1c663b52d01244059f97 Mon Sep 17 00:00:00 2001 From: Sophia Weber Date: Sun, 28 Jan 2024 18:03:04 +0100 Subject: [PATCH] Add hex String --- src/outputHandling.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/outputHandling.c b/src/outputHandling.c index b38a651..0a00670 100644 --- a/src/outputHandling.c +++ b/src/outputHandling.c @@ -2,7 +2,14 @@ #include "outputHandling.h" #include "inputHandling.h" +void hex(char* string, int number) { + sprintf(string, "%X", number); +} void printResult(calc_op* result) { - printf("Das Ergebnis ist: %f", result->result); + char buf[60] = {0}; + printf("Das Ergebnis ist: %f\n", result->result); + printf("Das Ergebnis in int: %i\n",(int)result->result); + hex(buf, (int)result->result); + printf("Das Ergebnis in hex: 0x%s\n", buf); ; } \ No newline at end of file