From 5ea71dbc5e5f65f9af165df941df207f1652cd3c Mon Sep 17 00:00:00 2001 From: Kevin Ludwig Date: Wed, 7 Feb 2024 21:39:15 +0100 Subject: [PATCH] auswahlspezifische ausgabe --- src/temperatur.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/temperatur.c b/src/temperatur.c index 6fd2f5b..0ccf6fc 100644 --- a/src/temperatur.c +++ b/src/temperatur.c @@ -36,6 +36,17 @@ const char* getFirstUnit(int input){ return "Kelvin"; return ""; } +const char* getSecondUnit(int input){ + if(input == 1 || input == 6) + return "° Fahrenheit"; + else if(input == 2 || input == 4) + return " Kelvin"; + else if(input == 3 || input == 5) + return "° Celsius"; + + + return ""; +} int run_TemperaturRechner(){ float var1, var2; @@ -71,7 +82,7 @@ int run_TemperaturRechner(){ break; } - printf("\nErgebnis: %.2f\n", var2); + printf(" = %.2f%s\n\n", var2, getSecondUnit(var3)); return 0;