# Thank you!

December 16 2007 at 10:06 PM

Response to Five mistakes... With those corrected, this runs. You'll have to check all the functions.

It finally works! :D

Thank you so much for all the help and bearing with me to those who helped me with this complex project. I probably would of have never finished without your help. I greatly appreciated it. Now all that's left is to tweak some of the printed answer statements.

Alas, this is the final code:

CLS
DIM choice AS STRING
DIM unit AS SINGLE
DIM inch AS SINGLE
DIM ft AS SINGLE
DIM mi AS SINGLE
DIM oz AS SINGLE
DIM lbs AS SINGLE
DIM cm AS SINGLE
DIM m AS SINGLE
DIM km AS SINGLE
DIM kg AS SINGLE
DIM g AS SINGLE
'american to metric conversions only for opposite units
'inch to cm
inch = 2.54
'ft to m
ft = .305
'mi to km
mi = 1.61
'oz to g
oz = 28.35
'lbs to kg
lbs = .454
'metric to american conversions only for opposite units
'cm to inch
cm = .394
'm to ft
m = 3.28
'km to mi
km = .62
'kg to lbs
kg = 2.2
'g to oz
g = .0353
DO
DO
INPUT "Which would you like to convert ([1] AMERICAN TO METRIC OR [2] METRIC TO AMERICAN)?", choice
LOOP UNTIL choice = "1" OR choice = "2"
IF choice = "1" THEN
DO
INPUT "Which type of measurement ([1] LENGTH, [2] WEIGHT OR [3] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3"
IF choice = "1" THEN
DO
INPUT "Which unit of length would you like to convert to ([1] INCH TO CENTIMER, [2] FOOT TO METER, [3] MILE TO KILOMETER OR [4] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3" OR choice = "4"
IF choice = "1" THEN
unit = unit * inch
PRINT unit; "is how many centimeters are in that many inch(s)"
EXIT DO
END IF
IF choice = "2" THEN
unit = unit * ft
PRINT unit; "is how many meters are in that many feet"
EXIT DO
END IF
IF choice = "3" THEN
unit = unit * mi
PRINT unit; "is how many meters are in that many mile(s)"
EXIT DO
END IF
ELSE
IF choice = "2" THEN
DO
INPUT "Which unit of weight would you like to convert to ([1] OUNCE TO GRAM, [2] POUND TO KILOGRAM OR [3] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3"
IF choice = "1" THEN
unit = unit * oz
PRINT unit; "is how many grams are in that many ounce(s)"
EXIT DO
END IF
IF choice = "2" THEN
unit = unit * lbs
PRINT unit; "is how many kilograms are in that many pound(s)"
EXIT DO
END IF
END IF
END IF
ELSE
IF choice = "2" THEN
DO
INPUT "Which type of measurement ([1] LENGTH, [2] WEIGHT OR [3] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3"
IF choice = "1" THEN
DO
INPUT "Which unit of length would you like to convert to ([1] CENTIMETER TO INCH, [2] METER TO FOOT, [3] KILOMETER TO MILE OR [4] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3" OR choice = "4"
IF choice = "1" THEN
unit = unit * cm
PRINT unit; "is how many inches are in that many centimeter(s)"
EXIT DO
END IF
IF choice = "2" THEN
unit = unit * m
PRINT unit; "is how many feet are in that many meter(s)"
EXIT DO
END IF
IF choice = "3" THEN
unit = unit * km
PRINT unit; "is how many miles are in that many kilometer(s)"
EXIT DO
END IF
ELSE
IF choice = "2" THEN
DO
INPUT "Which unit of weight would you like to convert to ([1] GRAM TO OUNCE, [2] KILOGRAM TO POUND OR [3] BACK)?", choice
LOOP UNTIL choice = "1" OR choice = "2" OR choice = "3"
END IF
IF choice = "1" THEN
unit = unit * g
PRINT unit; "is how many ounces are in that many gram(s)"
EXIT DO
END IF
IF choice = "2" THEN
unit = unit * kg
PRINT unit; "is how many pounds are in that many kilogram(s)"
EXIT DO
END IF
END IF
END IF
END IF
LOOP
END

 Respond to this message
 Response Title Author and Date Good, JoeP (View Thread) Mac on Dec 17

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums