Browse Source

added ConvertMode.c with all conversion options

remotes/origin/feature
Enrico Schellenberger 11 months ago
parent
commit
e1ed311b32
  1. 51
      src/main/c/ConvertMode.c
  2. 16
      src/main/c/main_taschenrechner.c

51
src/main/c/ConvertMode.c

@ -0,0 +1,51 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#include "taschenrechner.h"
// Unit converter mode
void unitConverterMode() {
int choice;
double value, result;
printf("Unit Converter Mode:\n");
printf("Distance conversions:\n");
printf("1. Convert Meter (cm, m, km)\n");
printf("2. Meter to foot/inches\n");
printf("3. Kilometer to Miles\n");
printf("Weight conversion:\n");
printf("4. Convert Gram (mg, g, kg)\n");
printf("Temprature conversion:\n");
printf("5. Celsius to Fahrenheit\n");
printf("Speed conversion:\n");
printf("6. km/h to mph \n");
printf("Fluid conversion:\n");
printf("7. Convert Liter (ml, l, kl) \n");
printf("8. Liter to Gallon\n");
printf("Data conversions:\n");
printf("9. 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("Time conversion \n");
printf("13. Convert time (s, m, h) \n");
printf("14. Convert Clock (12 Hour, 24 Hour) \n");
printf("\nEnter your choice (Exit with 0): ");
scanf("%d", &choice);
printf("Enter the value to convert: ");
scanf("%lf", &value);
}

16
src/main/c/main_taschenrechner.c

@ -166,23 +166,7 @@ void programmingMode() {
}
// Unit converter mode
void unitConverterMode() {
int choice;
double value, result;
printf("Unit Converter Mode:\n");
printf("1. Meter to Kilometer\n");
printf("2. Kilogram to Gram\n");
printf("3. Celsius to Fahrenheit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
printf("Enter the value to convert: ");
scanf("%lf", &value);
}
// change mode
int mode(int userChoice){

Loading…
Cancel
Save