diff --git a/src/main/c/ConvertMode.c b/src/main/c/ConvertMode.c index e9ec6ef..454577f 100644 --- a/src/main/c/ConvertMode.c +++ b/src/main/c/ConvertMode.c @@ -7,25 +7,39 @@ #include "taschenrechner.h" // Unit converter mode -double getValue() { - printf("Enter the first value to convert: "); +int choice, startingUnit, endingUnit; +double value, result; +char Distance[] = { 'mm', 'cm', 'm', 'km' }; +char Weight[] = { 'mg', 'g', 'kg', 't' }; +char Fluid[] = { 'ml', 'l' }; +char Data[] = { 'B', 'KB', 'MB', 'GB', 'TB', 'PT' }; +char Time[] = { 'ms', 's', 'min', 'h', 'd', 'w', 'mon', 'y' }; +char currency[] = { 'E', 'D', 'R' }; + +double getValue(int choice) { + printf("\nEnter the value to be converted: "); scanf("%lf", &value); - printf("Enter the second value to convert: "); - scanf("%lf", &value); - - while (choice < 0 && choice >= 14) { + while (choice < 0 && choice >= 15) { switch (choice) { case 1: + printf("\nEnter what the Unit is starting with: "); + scanf("%d", &startingUnit); + + printf("\nEnter what the value should it be changed to: "); + scanf("%d", &endingUnit); + result = ConMeter(value, startingUnit,endingUnit); + + printf("\nThe convertet result is %dlf %d", result, Distance[unit]); break; } } } -double ConMeter() { +double ConMeter(double meter, int startingUnit, int endingUnit) { } @@ -79,8 +93,6 @@ double ConClock() { void unitConverterMode() { - int choice; - double value, result; printf("Unit Converter Mode:\n"); @@ -91,31 +103,33 @@ void unitConverterMode() { printf("Weight conversion:\n"); printf("4. Convert Gram (mg, g, kg)\n"); + printf("5. Gram to Pounds \n") printf("Temprature conversion:\n"); - printf("5. Celsius to Fahrenheit\n"); + printf("6. Celsius to Fahrenheit\n"); printf("Speed conversion:\n"); - printf("6. km/h to mph \n"); + printf("7. km/h to mph \n"); printf("Fluid conversion:\n"); - printf("7. Convert Liter (ml, l, kl) \n"); - printf("8. Liter to Gallon\n"); + printf("8. Convert Liter (ml, l, kl) \n"); + printf("9. Liter to Gallon\n"); printf("Data conversions:\n"); - printf("9. Convert Data size (MB, GB, TB)\n"); + printf("10. Convert Data size (MB, GB, TB)\n"); printf("Area/Volume conversions \n"); - printf("10. Convert area (cm², m², km²) \n"); - printf("11. Convert Volume (cm³, m³, km³)\n"); + printf("11. Convert area (cm², m², km²) \n"); + printf("12. Convert Volume (cm³, m³, km³)\n"); printf("Time conversion \n"); printf("13. Convert time (s, m, h) \n"); printf("14. Convert Clock (12 Hour, 24 Hour) \n"); + printf("Time conversion \n"); + printf("15. Convert currency (Euro, Dollar, Russian Rubel) \n"); + printf("\nEnter your choice (Exit with 0): "); scanf("%d", &choice); - - - + getValue(choice); } \ No newline at end of file