#include<iostream> 
#include<string>
#include<cstring>
#include<cstdlib>
using namespace std;
void strcopy(string string1,string string2);
void writefile(string string3); 
int main(){
	string string1;
	string string2;
	cout<<"enter the 1st string\n";
	cin>>string1;
	cout<<"enter the 2nd string\n";
	cin>>string2;
	cout<<"1+2 or 2+1?\n";
	string select;
	cin>>select;
	if(select=="1+2")
	strcopy(string1,string2);
	else if(select=="2+1")
	strcopy(string2,string1);
	select="0";
	cout<<"do you want to write the adden\
	string to file?y or n\n";
	cin>>select;
	if(select=="y"){
		string d;
		d=string1+"   "+string2;
		writefile(d);
	}
	system("pause");
	return EOF;
}
void strcopy(string string1,string string2){
	string c;
	c=string1+"   "+string2;
	cout<<c<<endl;
} 
void writefile(string string3){
    FILE *fp; 
    std::string filename;
    int i;
    std::cout<<"enter the filename you want to write\n";
    cin >> filename;
    fp=fopen(filename.c_str(),"w");
    fprintf(fp,"%s\n",string3.c_str());
    printf("finish write file,file will close and goto the \
	program's end\n");
    fclose(fp);
}