Browse Source

added ConMeterToFeet logic to ConvertMode.c

remotes/origin/feature
Enrico Schellenberger 11 months ago
parent
commit
7ad539f78d
  1. 48
      src/main/c/ConvertMode.c

48
src/main/c/ConvertMode.c

@ -37,6 +37,18 @@ double getValue(int choice) {
printf("\nThe convertet result is %dlf %d", result, Distance[endingUnit]); printf("\nThe convertet result is %dlf %d", result, Distance[endingUnit]);
break; break;
case 2:
printf("\nEnter what the Unit is starting with (0 feet/Inch, 1 meter): ");
scanf("%d", &startingUnit);
printf("\nEnter what the value should it be changed to (0 feet/Inch, 1 meter): ");
scanf("%d", &endingUnit);
result = ConMeterToFoot(value, startingUnit, endingUnit);
printf("\nThe convertet result is %dlf %d", result, Distance[endingUnit]);
break;
} }
} }
} }
@ -141,8 +153,42 @@ double ConMeter(double meter, int startingUnit, int endingUnit) {
} }
} }
double ConMeterToFoot() {
double ConMeterToFoot(double distance, int startingUnit, int endingUnit) {
switch (startingUnit)
{
case 0: //feet/inch to x
switch (endingUnit)
{
case 0: //feet/inch to feet/inch
return distance;
break;
case 1: //feet/inch to meter
return distance / 3,28084;
break;
default:
break;
}
case 1: //meter to x
switch (endingUnit)
{
case 0: //meter to feet/inch
return distance * 3, 28084;
break;
case 1: //feet/inch to feet/inch
return distance;
break;
default:
break;
}
default:
break;
}
} }
double ConKilometerToMiles() { double ConKilometerToMiles() {

Loading…
Cancel
Save