I do not understand what I am doing wrong here in this function. I am pretty sure I am using the parameters correctly. Is there a #include file I missed?
int countTemplate(const string& str)
{
int count = 0;
while (!str.empty())
{
size_t beginningTemp;
size_t endTemp;
string foundTemp;
beginningTemp = str.find('@');
endTemp = str.find('@', beginningTemp+1);
foundTemp = str.substr(beginningTemp, (endTemp + 1) - beginningTemp);
count++;
str.replace(str.find('@'), (endTemp + 1) - beginningTemp, "");
}
return count;
}
Aucun commentaire:
Enregistrer un commentaire