All pastes #507797 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-24 19:07 UTC
rendered paste body
pair<string,string> strtokenizer(string& chaine,string& delim,pair& mot){
     int i;
     int nbMots; //nombres de mots trouvés
     string tmpchaine; //contient une sous-chaine trouvé temporairement
     pair<string,string> motchaine;
     
     for(i=0;i<chaine.length();i++){
         if(chaine[i]!=delim){
            tmpchaine+=chaine[i];
         }
         else{//On arrive au delemiteur ici
             if(tmpchaine!=""){
                nbMots++; //augementer le nombre de mots trouvés
                if(nbMots<=2)
                   if(motchaine.first==""){
                      motchaine.first=tmpchaine;
                      tmpchaine="";
                   }
                   else{
                        motchaine.second=tmpchaine;
                        tmpchaine="";
                   }
              }
              else{
                   cout<<"Erreur"<<endl;
                   return false;
              }
         }
     }
     return mot;
}