Hi Z.
I believe in making thigns easy for beginners. When I was a begfinner, I had chances to read many well writtne programs of other programmers. I hope that you gtet it too. I have been accused of being a mug. I don't mind it.
#include <iostream.h>

#include <string>
using namespace std;

void Union(string &a,string &b);

int main()
	string s1 = "122347", s2 = "44567",s3="";

	cout << "First string: "<<s1.c_str()<<'\n';
	cout << "Second string: " << s2.c_str() <<'\n';


	cout << "Final string: " << s3.c_str() << '\n';
	return 0;

void Union(string &s2,string &s3)
	for (int i=0;i<s2.size();i++){
		char c = s2[i];
		bool is_c_in_s3 =false;
		for (int j=0;j<s3.size();j++){
			if (c==s3[j]){
				is_c_in_s3 = true;
		if (!is_c_in_s3) s3+=c;

Last edited by shabbir; 25Feb2012 at 13:56.. Reason: Code blocks