![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 243
Rep Power: 3
![]() |
Associating enumerations...
I am trying to make 2 enumerations to equal each other. basically, i have this equalities for each letter of the alphabet:
a = e b = x c = i ...and I am trying to associate in some way 2 enumerations with each other, so that when I call the position with, lets say the 'a' letter inside it, 'e' is returned. Is there a way to do so, or must I stick with the old "switch" statement? NOTE: It's not homework, It's just something I want to do because I need it to decode something from a game... :o
__________________
Project::Soulstorm (personal homepage) |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Lookup table?
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
map??
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 243
Rep Power: 3
![]() |
Yup, as I can see, <map> is the thing I will use... time to go and check some documentation about STL maps... Thank you for helping the noob
![]()
__________________
Project::Soulstorm (personal homepage) |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|