Horje
c++ get char of string Code Example
indexing strings in c++
// string::operator[]
#include <iostream>
#include <string>

int main ()
{
  std::string str ("Test string");
  for (int i=0; i<str.length(); ++i)
  {
    std::cout << str[i];
  }
  return 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;
}
c++ get char of string
// string::at
#include <iostream>
#include <string>

int main ()
{
  std::string str ("Test string");
  for (unsigned i=0; i<str.length(); ++i)
  {
    std::cout << str.at(i);
  }
  return 0;
}




Cpp

Related
Find subarray sum in c++ Code Example Find subarray sum in c++ Code Example
how to declare a 2d boolean vector in c++ Code Example how to declare a 2d boolean vector in c++ Code Example
Find Subarray sum using c++ Code Example Find Subarray sum using c++ Code Example
find height of a tree Code Example find height of a tree Code Example
dogecoin price Code Example dogecoin price Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9