This question already has an answer here:
- Alternative for-loop syntax [duplicate] 2 answers
In this question why the for loop is starting from ;
if the for loop is starting from ;
what does it mean???and also what is the meaning of string word="";
?
string word = "";
for (; i < str.length(); i++) {
if (str[i] != ' ')
word += str[i];
else {
reverse(word.begin(), word.end());
cout << word << " ";
word = "";
}
}
Aucun commentaire:
Enregistrer un commentaire