|
|
@ -10,7 +10,7 @@ |
|
|
|
int choice, startingUnit, endingUnit; |
|
|
|
double value, result; |
|
|
|
|
|
|
|
char Distance[] = { 'mm', 'cm', 'm', 'km' }; |
|
|
|
char Distance[] = { 'mm', 'cm', 'm', 'km', 'feet/inch', 'miles'}; |
|
|
|
char Weight[] = { 'mg', 'g', 'kg', 't' }; |
|
|
|
char Fluid[] = { 'ml', 'l' }; |
|
|
|
char Data[] = { 'B', 'KB', 'MB', 'GB', 'TB', 'PT' }; |
|
|
@ -46,6 +46,15 @@ double getValue(int choice) { |
|
|
|
|
|
|
|
result = ConMeterToFoot(value, startingUnit, endingUnit); |
|
|
|
|
|
|
|
if (endingUnit == 0) { //if feet/inch change to 4. in array of Distance |
|
|
|
endingUnit = 4; |
|
|
|
} |
|
|
|
|
|
|
|
else if (endingUnit == 1) { //if meter change to 2. in array of Distance |
|
|
|
endingUnit = 2; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
printf("\nThe convertet result is %dlf %d", result, Distance[endingUnit]); |
|
|
|
break; |
|
|
|
|
|
|
@ -58,6 +67,28 @@ double getValue(int choice) { |
|
|
|
|
|
|
|
result = ConKilometerToMiles(value, startingUnit, endingUnit); |
|
|
|
|
|
|
|
if (endingUnit == 0) { //if miles change to 5. in array of Distance |
|
|
|
endingUnit = 5; |
|
|
|
} |
|
|
|
|
|
|
|
else if (endingUnit == 1) { //if kilometer change to 2. in array of Distance |
|
|
|
endingUnit = 3; |
|
|
|
} |
|
|
|
|
|
|
|
printf("\nThe convertet result is %dlf %d", result, Distance[endingUnit]); |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
case 4://'mg', 'g', 'kg', 't' |
|
|
|
printf("\nEnter what the Unit is starting with (0 mg, 1 g, 2 kg , 3 t): "); |
|
|
|
scanf("%d", &startingUnit); |
|
|
|
|
|
|
|
printf("\nEnter what the value should it be changed to (0 mg, 1 g, 2 kg , 3 t): "); |
|
|
|
scanf("%d", &endingUnit); |
|
|
|
|
|
|
|
result = ConKilometerToMiles(value, startingUnit, endingUnit); |
|
|
|
|
|
|
|
printf("\nThe convertet result is %dlf %d", result, Distance[endingUnit]); |
|
|
|
break; |
|
|
|
|
|
|
@ -203,7 +234,7 @@ double ConMeterToFoot(double distance, int startingUnit, int endingUnit) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
double ConKilometerToMiles() { |
|
|
|
double ConKilometerToMiles(double distance, int startingUnit, int endingUnit) { |
|
|
|
switch (startingUnit) |
|
|
|
{ |
|
|
|
case 0: //miles to x |
|
|
|