Switching between two type of units
Hi,
In my application I have two type of units - english and northamerican style i.e, lbs and Kgs ( for weight, etc.). Is there any easier way to toggle between the two types rather than writing code for each??
I will appreciate your hints and ideas.
Thanks.
Re: Switching between two type of units
You might try something like this: Carry a variable of some type in your program to tell you what unit system you want to work with. Then add a 'conversion factor' to all your calculation routines. Write all your calculation code but replace Units with (Units * Conversion Factor). Then all you have to do is check which unit system you are in and adjust the conversion factor appropriately.