How to erase character from string (delete N character from specific index) in C++

1 Answer

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

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

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

	s.erase(4, 3);

	cout << s << endl;

	return 0;
}

/*
run:

c++ gramming

*/

 



answered May 8, 2018 by avibootz
edited May 8, 2018 by avibootz

Related questions

1 answer 182 views
1 answer 155 views
1 answer 192 views
2 answers 219 views
1 answer 156 views
2 answers 182 views
2 answers 262 views
...