Read in values and enumerating values

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I have an external table in a text file. The file has information about each insurance product. There are about 25 names for each insurance product. Right now I differentiate each product by an integer.
So in the text file, each name has an integer. It would seem more intuitive to have the user input the actual name, and convert the name to an integer.
Another example, is the policy file has either "M" or "F" standing for male female, but the code uses integers 1 or 0. For these values, I had an if statement with something like
if (var == "M") SexType = 1; else SexType = 0;
Is there a way to efficiently do this with enumeration.
Thanks



View the full article
 


Write your reply...
Back
Top