Hi everybody,
What I did is, I have 2 one dimensional vector which are inside structure.
int numberofactivities;
struct PopL{
vector<double> RK; //For Random Key
};
//Random keys for left population
vector<PopL> PopL(3);
srand((unsigned)time(NULL));
for (int j=0; j<3; j++){
for (int i=0; i<numberofactivities;++i)
{
rn=((double) rand() / (RAND_MAX+1)) ;
PopL[j].RK.push_back(rn);
}
}
For Example;
numberofactivities=3
PopL[1].RK[0]=0.567
PopL[1].RK[1]=0.587
PopL[1].RK[2]=0.467
PopL[2].RK[0]=0.265
PopL[2].RK[1]=0.597
PopL[2].RK[2]=0.867
and what I want is that,
First I want to give id to all RK numbers and sorting them.
For example;
PopL[1].RK[0]=0.567 so PopL[1].RK[0].id=2
PopL[1].RK[1]=0.587 so PopL[1].RK[1].id=3
PopL[1].RK[2]=0.467 so PopL[1].RK[2].id=1
PopL[2].RK[0]=0.265 so PopL[2].RK[0].id=1
PopL[2].RK[1]=0.597 so PopL[2].RK[1].id=2
PopL[2].RK[2]=0.867 so PopL[2].RK[2].id=3
ids will given by starting small one to bigger one.
I just thing about nested vectors inside structure but I couldn't do.
Thank you