Is there a way to input the name of a string and return the value of an integer that has the same name as the string? For example, suppose I have this program...
I would like it to read the name of the string and find the return the integer of the same name as the string. I think it can be done in Java using getInteger( String nm, int val ). Is this possible in C++? Thanks.
using namespace std;
string nameofstring = "test";
int test = 1;
cout << nameofstring; //outputs the word "test", I would like it to output the integer 1. How do I do this?