Search
 
SCRIPT & CODE EXAMPLE
 

CPP

index string c++

#include <string>
#include <iostream>

int main(){
  //index string by using brackets []
  std::string string = "Hello, World!";
  //assign variable to string index
  char stringindex = string[2];
  
}
Comment

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

PREVIOUS NEXT
Code Example
Cpp :: c++ get character from string 
Cpp :: size of pointer array 
Cpp :: Xor implementation C++ 
Cpp :: file c++ 
Cpp :: struct and pointer c++ 
Cpp :: c++ remove last character from string 
Cpp :: convert decimal to binary in c++ 
Cpp :: c++ remove text file 
Cpp :: declare nullptr c++ 
Cpp :: lambda c++ 
Cpp :: function c++ 
Cpp :: std::iomanip c++ 
Cpp :: int main() { 
Cpp :: opencv open image c++ 
Cpp :: draw rectangle opencv c++ 
Cpp :: modulo subtraction 
Cpp :: how to convert ascii to char in cpp 
Cpp :: c++ input 
Cpp :: c++ vs g++ 
Cpp :: power function c++ 
Cpp :: find element in vector 
Cpp :: automatic legend matlab 
Cpp :: word equation numbers 
Cpp :: C++ Increment and Decrement 
Cpp :: cpp ifdef 
Cpp :: return array of string in function c++ 
Cpp :: access last element of set c++ 
Cpp :: c++ shell 
Cpp :: c++ variable types 
Cpp :: ue4 c++ replicate actor variable 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =