Answers for "how to iterarte thorough the end of the string in c++"

C++
1

iterating string in cpp

std::string s("Hello world");

for (char & c : s)
{
    std::cout << "One character: " << c << "\n";
    c = '*';
}
Posted by: Guest on May-23-2021
2

how to iterate throguh a string in c++

void print(const std::string &s)
{
    for (std::string::size_type i = 0; i < s.size(); i++) {
        std::cout << s[i] << ' ';
    }
}
Posted by: Guest on July-22-2020

Code answers related to "how to iterarte thorough the end of the string in c++"

Browse Popular Code Answers by Language