How to appends to string part of other string in C++

1 Answer

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

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

int main()
{
	string s1("c++ programming"), s2 = "***";

	s2.append(s1, 0, 7);

	cout << s2 << endl;

	return 0;
}

/*
run:

***c++ pro

*/

 



answered May 8, 2018 by avibootz
...