I have a set of numbers that I need to pass from a function to a few other functions before it is actually used. I figured an array is a good way to do this, however I can't remember how to do what I want to do. The code looks like this
int set1; // variables that hold settings
int set2;
int set3;
cout << "Setting 1";
cin >> set1;
cout << "Setting 2";
cin >> set2;
cout << "Setting 3";
cin >> set3;
int settings[3] = {set1, set2, set3}; //array that holds variables
so that is how the array is created.
However what I am hoping is to be able to do something like this, I know some languages can ( I am pretty sure), but I don't know if C++ can, or what this method is even called (so I can't google it)
int setting0;
int setting1;
int setting2;
for(int i=0; i<3; i++)
{
setting+i = setting[i]; // should set setting0 = setting[0]; etc
}
Am I going about this the wrong way?