How to append string to string in C++

1 Answer

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

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

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

	s.append(" programming");

	cout << s << endl;

	return 0;
}

/*
run:

c++ programming

*/

 



answered May 8, 2018 by avibootz

Related questions

1 answer 155 views
155 views asked Jan 15, 2020 by avibootz
1 answer 208 views
1 answer 191 views
2 answers 130 views
130 views asked Oct 19, 2023 by avibootz
1 answer 190 views
1 answer 170 views
...