Answers for "c++ edit specific index of string"

C++
4

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];
  
}
Posted by: Guest on June-15-2020
1

replace a char in string c++ at a specific index

string a = "lol";
	a[2] = 'j';
	cout << a;
//output: loj
Posted by: Guest on August-06-2020

Code answers related to "c++ edit specific index of string"

Browse Popular Code Answers by Language