Hi again;
Today I've got some silly questions about the translation of an algorithm to c++ :S (hey matrimkar, I found something that should work!:idea: )
well, my questions are in comments in this code:
You can just read the first 2 paragraphs of the code, the 3rd one is quiet the same.
bool b1=false;
vector<photon>::iterator It1=v1.begin(), It2=v2.begin();
while(b1==false)
{
for(int i=It1;i<=v1.end();i++) //can I affect the value of It1 to i ?
{
if (v1.at(i)>=*It2)
{
It1=i; //I'm doing so because I want the while to know in its (2nd,3rd,...) iteration at which value the for iteration stopped
break;
}
}
if(*It1!=*It2)
{
for(int i=It2+1;i<=v2.end();i++) //here it's worse: i=It2+1, I want the i to have the "rank" of the element just after It2
{
if(v2.at(i)>=*It1)
{
It2=i;
if(v2.at(i)==*It2) g++; //dont worry about g, it's an external function
It1++;
break;
}
}
}
else
{
g++;
for(int i=It2+1;i<=v2.end();i++)
{
if(v2.at(i)>=*(It1+1))
{
It2=i;
if(v2.at(i)==*(It1+1)) g++;
It1++;
break;
}
}
if(It1==v1.end()) b1=true;
}
}