How to read input and get information.

Hi all, what I'm trying to do is make a chemistry calculator. What I would like to do is have the user type in the element, say He, and then the program will retrieve the value that I have assigned (in a .h) and then put it into the equation. So how would I go about doing this?
You can use a std::map
eg:
1
2
3
4
5
6
7
map<string,int>elements;
elements["He"] = 2;

string input;
cin >> input;

//use elements[input] to get '2' in this example 
Topic archived. No new replies allowed.