jeudi 26 mai 2016

push_back a char from a string to another string

I'm trying to append some characters from one string to another, but I couldn't do it. I tried something like this:

std::string fooz = "fooz";
std::string foo;
int i = 0;
while(i< foo.length()){
    if(fooz[i] != 'z'){
       foo.push_back(fooz[i]);
    }
    i++;
}

Aucun commentaire:

Enregistrer un commentaire