All pastes #80410 Raw Edit

Untitled

public text v1 · immutable
·published 2006-07-06 11:39 UTC
rendered paste body
bool reorder(vector<string>& veco)
{
int conta=0;
int  contapiu=0;
string uno,due,temp1,temp2;
int unon=0;
int duen=0;
string rel1, rel2;
bool found=false;
while(found)
            {
            found=false;
            while (conta<veco.size())
                {
                if ((conta+1)<veco.size())contapiu=conta+1;else contapiu=conta;
                uno=veco[conta];
                due=veco[contapiu];
                if(((uno.size())>1)&&(due.size()>1))
                                                    {
                                                               rel1= StringToUpper(uno.substr(0,1));
                                                               rel2= StringToUpper(due.substr(0,1));
                                                    }
                else
                {
                rel1="";
                rel2="";
                }
                if((rel1=="L") &&(rel2=="L"))
                                                    {
                                                    rel1= StringToUpper(uno.substr(1,(uno.size())));
                                                    rel2= StringToUpper(due.substr(1,(due.size())));
                                                    StringToInt(&unon,&rel1);
                                                    StringToInt(&duen,&rel2);
                                                    if(unon>duen)
                                                                {
                                                                veco[conta]=due;
                                                                veco[contapiu]=uno;        
                                                                found=true;      
                                                                }
                                                    }
                else
                                                    { 
                                                    StringToInt(&unon,&uno);
                                                    StringToInt(&duen,&due);
                                                    if(unon>duen){
                                                                      veco[conta]=due;
                                                                      veco[contapiu]=uno;         
                                                                      found=true;     
                                                                  }    
                                                    }
                conta++;
                }
            }
return true;
}