how to iterate in string in c++

#include <iostream>
#include <string>

int main() {
    std::string str = "Hello, World!";
    for (char c : str) {
        std::cout << c << std::endl;
    }
    return 0;
}