how to iterate a string cpp code example
Example: how to iterate in string in c++
#include<iostream>
using namespace std;
main() {
string my_str = "Hello World";
for(int i = 0; i<my_str.length(); i++) {
cout << my_str.at(i) << endl; //get character at position i
}
}