Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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
   }
}
Comment

string iterator in c++

// string::begin/end
#include <iostream>
#include <string>

int main ()
{
  std::string str ("Test string");
  for ( std::string::iterator it=str.begin(); it!=str.end(); ++it)
    std::cout << *it << endl;
  std::cout << '
';

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to store pair in min heap in c++ 
Cpp :: C++ press enter to continue function 
Cpp :: cpp insert overload operator 
Cpp :: What is the story of c++ 
Cpp :: minimum value in array using c++ 
Cpp :: all possible permutations of characters in c++ 
Cpp :: c++ program to reverse an array 
Cpp :: count bits c++ 
Cpp :: c++ isalphanum 
Cpp :: c++ iterate over vector of pointers 
Cpp :: 1523. Count Odd Numbers in an Interval Range solution in c++ 
Cpp :: create a 2d vector in c++ 
Cpp :: joins in mysql use sequelize 
Cpp :: console colors in C++ 
Cpp :: what is c++ standard library 
Cpp :: powershell get uptime remote computer 
Cpp :: even and odd sum in c++ 
Cpp :: deep copy c++ 
Cpp :: reverse order binary tree in c++ 
Cpp :: See Compilation Time in c++ Program 
Cpp :: c++ input 
Cpp :: cpp mark getter as const 
Cpp :: gettimeofday header file 
Cpp :: best websites for programming 
Cpp :: cpp string find all occurence 
Cpp :: quicksort geeksforgeeks 
Cpp :: linked list in c++ 
Cpp :: doubly linked list code in c++ 
Cpp :: system("pause") note working c++ 
Cpp :: bfs to detect cycle in undirected graph 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =