Hi,
I dont know much about programming, however I have a c++ program(i didnt write it) that I need to use it to do some experiments. When I compile the program I get this errror.
dynn.cpp: In function ‘void make_near()’:
dynn.cpp:374: error: name lookup of ‘j’ changed for new ISO ‘for’ scoping
dynn.cpp:370: error: using obsolete binding at ‘j’
Could you help me to fix this please? As I mentioned before i dont know much about programming.So I would appreciate it if you can guide me in the simplest way as possible. Thank you.
dynn.cpp
void make_near()
{
int real_input;
int real_hidden;
real_input = xnow.m_input + xnow.m_input*(xnow.m_input+1)/2;
real_hidden = 2 * real_input;
int alter = (real_input + 2) * real_hidden + 1;
int length1 = (real_input + 1) * real_hidden;
int length2 = real_hidden + 1;
alter = alter / 10 + 1;
int p;
int p1;
int p2;
for(int i=0;i<NO_OF_POPU;i++)
{
for(int j=0;j<(real_input + 1) * real_hidden;j++)
{
xnear[i].m_weights1[j] = xnow.m_weights1[j];
}
for(j=0;j<real_hidden+1;j++)
{
xnear[i].m_weights2[j] = xnow.m_weights2[j];
}
for(int k=0;k<alter;k++)
{
p = (int)(rand() % 2);
if(p == 0)
{
p1 = (int)(rand() % length1);
xnear[i].m_weights1[p1] += produce_rand_double(-1./LENGTH,1./LENGTH);
}
if(p == 1)
{
p2 = (int)(rand() % length2);
xnear[i].m_weights2[p2] += produce_rand_double(-1./LENGTH,1./LENGTH);
}
}
xnear[i].m_fitness = count_nn_fitness(xnear[i]);
}
}