From dd0176d5dc7d01c6e8005d1eacd4d6aa6141ab9a Mon Sep 17 00:00:00 2001 From: Laurin Date: Tue, 6 Feb 2024 15:05:29 +0100 Subject: [PATCH] refactoring: changed variable names to be more specific --- src/conversionOfNumbers/main.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/conversionOfNumbers/main.c b/src/conversionOfNumbers/main.c index b6b5151..fe11889 100644 --- a/src/conversionOfNumbers/main.c +++ b/src/conversionOfNumbers/main.c @@ -4,47 +4,47 @@ #include int main(){ - int min = 0; - int max = 2; - int InputSys; - while(InputSys != 3){ + int minInput = 0; + int maxInput = 2; + int InputMainMenu; + while(InputMainMenu != 3){ printf("\nWaehle Zahlensystem:\n" "\n<0> Binaer System\n" "<1> Hexadezimal System\n" "<2> Beenden\n"); - InputSys = usergetd("\nEingabe: ", &min, &max); - if(InputSys == 2) break; - int InputProg; + InputMainMenu = usergetd("\nEingabe: ", &minInput, &maxInput); + if(InputMainMenu == 2) break; + int InputOptionsMenu; - while(InputProg != 3){ + while(InputOptionsMenu != 3){ printf("\nZu oder von einer Dezimalzahl konvertieren?\n" "\n<0> Zu\n" "<1> Von\n" "<2> Hauptmenue\n"); - InputProg = usergetd("\nEingabe: ", &min, &max); - if(InputProg == 2) break; - if(InputSys == 0){ - if(InputProg == 0){ + InputOptionsMenu = usergetd("\nEingabe: ", &minInput, &maxInput); + if(InputOptionsMenu == 2) break; + if(InputMainMenu == 0){ + if(InputOptionsMenu == 0){ char* toConvert = usergets("\nGeben Sie eine Zeichenkette von 0 und 1 ein: ", NULL, NULL); int result = convertBinaryStrToInt(toConvert); printf("\nAusgabe (in Dezimal): %d\n", result); } - if(InputProg == 1){ + if(InputOptionsMenu == 1){ int toConvert = usergetd("\nGeben Sie eine Ganzzahl ein: ", NULL, NULL); char* result = convertIntToBinaryStr(toConvert); printf("\nAusgabe (in Binaer): %s\n", result); free(result); } } - if(InputSys == 1){ - if(InputProg == 0){ + if(InputMainMenu == 1){ + if(InputOptionsMenu == 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){ + if(InputOptionsMenu == 1){ int rangeMin = 0; int toConvert = usergetd("\nGeben Sie eine positive Ganzzahl ein: ", &rangeMin, NULL); char* result = convertIntToHex(toConvert);