C + + implements the stitching of two files.

Source: Internet
Author: User

Problem Description:

A second file is required to be stitched to the end of the first file. such as the file2 stitching to the end of file. (Just copy it soon!) But the teacher does not let the programming, really is the egg ache!! )。 For example:

File1:i am not responsible of this code.   They made me write it, against my'll. File2:when I wrote this, only God and I understood what I was doing.   Now, God is only kowns. After stitching: file1:i am not responsible of this code. They made me write it, against my'll. When I wrote this, only God and I understood what I was doing. Now, God is only kowns.

Knowledge Points: File stream classes.

#include <iostream>#include<fstream>using namespacestd;Const intMAXN = ++Ten;intMain () {CharSTR[MAXN]; Ifstream Cin ("File2.txt"); Ofstream cout ("file1.txt", Ios::app);  while(Cin.getline (str, MAXN)) {cout<<str<<Endl; }    return 0;}

Do not copy in a week! In case the work is identical!

C + + implements the stitching of two files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.