How to erase (delete) the second character from a string in C++

1 Answer

0 votes
#include <iostream>
#include <string>

using std::cout;
using std::endl;
using std::string;

int main()
{
	string s("programming c++");

	s.erase(s.begin() + 1);

	cout << s << endl;

	return 0;
}

/*
run:

pogramming c++

*/

 



answered May 9, 2018 by avibootz

Related questions

1 answer 122 views
2 answers 167 views
1 answer 115 views
2 answers 141 views
1 answer 140 views
2 answers 203 views
...