I wanted to ask about how to convert a string to a char *, the case is the one shown below, where I have a defined string and I want to name the variable x using .setName (), but it receives a char *, so that I can not simply place variable names for the string as an argument to the .setName () (the for cycle was the idea). Any ideas on how to put a string in .setName () as an argument? Or maybe not define it as string?
IloNumVarArray x;
string nombresvariables[12] = {"x11","x21","x31","x41","x12","x22","x32","x42","x13","x23","x33","x43"};
for (int i = 0; i < 12; i++) {
x[i].setName(); //numero de variables
}
//x[0].setName("x11"); evitar tener que hacer esto
//x[1].setName("x21");
//x[2].setName("x31");
//x[3].setName("x41");
//x[4].setName("x12");
//x[5].setName("x22");
//x[6].setName("x32");
//x[7].setName("x42");
//x[8].setName("x13");
//x[9].setName("x23");
//x[10].setName("x33");
//x[11].setName("x43");