All pastes #507809 Raw Edit

Untitled

public cpp v1 · immutable
·published 2007-05-24 19:13 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 motchaine;}