Trying to figure out how this doesnt work for like 45 minutes and i think i must doing something stupid.
If you see plz point out. BTW its supposed to take 2 special strings and output them in 2 columns.
CODE
string sortOutput(string output1, string output2)
{
string result="";
int h1=output1.length();
int h2=output2.length();
int pos1=output1.find('\n');
int pos2=output2.find('\n');
int pos3,pos4;
while ((pos1>=0 && pos1<h1) && (pos2>=0 && pos2<h2))
{
pos3=output1.find('\n',pos1);
if (pos3>=0 && pos3<h1)
{
result=result+output1.substr(pos1+2,pos3-2);
}
else
{
result=result+"\t";
}
pos1=pos3;
pos4=output2.find('\n',pos2);
if (pos4>-1 && pos4<h2)
{
result=result+output2.substr(pos2+2,pos4-2);
}
else
{
result=result+"\n";
}
pos2=pos4;
}
return result;
}