#include "stdafx.h"
#include
#include
#include
using namespace std;
main ()
{
string str;
ifstream f1 ( "1.txt" );
if (f1.fail())
{
cerr<<"open failure on 1.txt"<
}
ifstream f2 ( "2.txt" );
if (f2.fail())
{
cerr<<"open failure on 2.txt"<
}
ofstream out ( "3.txt" );
if (out.fail())
{
cerr<<"open failure on 3.txt"<
}
while ( getline (f1, str))
{
out<
while ( getline (f2,str))
{
out<
f1.close();
f2.close();
out.close ();
return 0;
}
可以参照这个试试