From 2157c6a2f47bb99d4431735ccf538b9c3cd3da52 Mon Sep 17 00:00:00 2001 From: Laurin Date: Tue, 6 Feb 2024 14:40:02 +0100 Subject: [PATCH] Implemented interface and functions to convert from or into hexadecimal system in main program --- src/conversionOfNumbers/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/conversionOfNumbers/main.c b/src/conversionOfNumbers/main.c index fe9d7ec..c2679ca 100644 --- a/src/conversionOfNumbers/main.c +++ b/src/conversionOfNumbers/main.c @@ -36,6 +36,19 @@ int main(){ printf("\nAusgabe (in Binaer): %s\n", result); } } + if(InputSys == 1){ + if(InputProg == 0){ + char* toConvert = usergets("\nGeben Sie eine Zeichenkette im Hexadezimal-Format ein: ", NULL, NULL); + int result = convertHexStrToInt(toConvert); + printf("\nAusgabe (in Dezimal): %d\n", result); + } + if(InputProg == 1){ + int rangeMin = 0; + int toConvert = usergetd("\nGeben Sie eine positive Ganzzahl ein: ", &rangeMin, NULL); + char* result = convertIntToHex(toConvert); + printf("\nAusgabe (in Hex): %s\n", result); + } + } } } return 0;