Строки С++ | Кто знает решение,помогите пожалуйста(задание 1)

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

/*int OutputFirstFile() {
    ifstream firstFile("C:\\Users\\Home\\Desktop\\First.txt");
    string str;
    int n = 0; cout << "Введите количество строк для первого файла"; cin >> n;
    while (n > 0) {
        for (int i = 0; i < n; i++) {
            cout << "Введите " << i + 1 << " строку,первого файла"; getline(firstFile,)
            firstFile >> 
        }
        
        
    }
    
}*/

void OutputSecondFile() {
    ofstream secondFile("C:\\Users\\Home\\Desktop\\Second.txt");
    int k = 0; cout << "Введите количество строк для второго файла"; cin >> k;
}

void StrPlusStr() {
    char buff[100];
    //ofstream firstFile("First.txt");
    fstream firstFile("first.txt");
    fstream secondFile("second.txt");

    int firstCount = 5, secondCount = 5;
    string firstStr, secondStr;

    getline(firstFile, firstStr);
    getline(secondFile, secondStr);

    

    if (!firstFile.is_open() || !secondFile.is_open()) {
        cout << "Файл не открыт";
    }
    else {
        if (firstCount == secondCount) {
            for (int i = 0; i < firstCount; i++) {
                getline(firstFile, firstStr);
                getline(secondFile, secondStr);
                
                //cout << "1 файл " << firstStr << endl;
                //cout << "2 файл " << secondStr << endl;
                firstStr.append(secondStr);
                //cout << firstStr << endl ;
                firstFile << firstStr << endl;


            }
            //firstFile >> buff;
            //cout << buff;
        }

    }

    firstFile.close();
    secondFile.close();

Ответы (0 шт):