Answers for "c++ read a string by characters"

C++
0

c++ get character from string

#include <iostream>
#include <string>

int main() {
    std::string myStr = "test string";

    for (int i = 0; i < myStr.length(); ++i) {
        std::cout << myStr.at(i) << std::endl;
    }

    return 0;
}
Posted by: Guest on March-29-2021
0

c++ read each char of string

std::string str = ???;
for(std::string::iterator it = str.begin(); it != str.end(); ++it) {
    do_things_with(*it);
}
Posted by: Guest on November-12-2020

Code answers related to "c++ read a string by characters"

Browse Popular Code Answers by Language