|
|
@ -4,47 +4,47 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
|
|
|
|
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); |
|
|
|