Questo è il mio codice, per i file input sono in .txt e non riesco ad allegarli, possibile?? Ho provato a fare anche una cartella .zip ma niente.
Grazie
#include<iostream>
#include<fstream>
#include <sstream>
using namespace std;
int main()
{
string buffer;
ofstream out;
ifstream in1, in2;
out.open("out-ciclo.txt");
in1.open("1-9 - Nodo 1.txt");
in2.open("1-9 - Nodo 2.txt");
int countline(1);
while(getline(in1,buffer))
{
countline %= 34;
if (countline == 2) {
buffer.erase (0,20);
buffer.erase (8,12);
buffer.erase (19,68);
out<<buffer;
} else if (countline == 5) {
buffer.erase (1,37);
buffer.replace (2,1,",");
out<<buffer;
} else if (countline == 20) {
buffer.erase (2,42);
buffer.erase (16,1);
out<<buffer;
} else if (countline == 21) {
buffer.erase (2,45);
buffer.erase (16,1);
out<<buffer;
} else if (countline == 24) {
buffer.erase (1,19);
out<<buffer<<endl;
}
else
buffer.clear();
countline++;
}
in1.close();
countline=0;
buffer.clear();
while(getline(in2,buffer))
{
countline %= 34;
if (countline == 2) {
buffer.erase (0,20);
buffer.erase (8,12);
buffer.erase (19,68);
out<<buffer;
} else if (countline == 5) {
buffer.erase (1,37);
buffer.replace (2,1,",");
out<<buffer;
} else if (countline == 20) {
buffer.erase (2,42);
buffer.erase (16,1);
out<<buffer;
} else if (countline == 21) {
buffer.erase (2,45);
buffer.erase (16,1);
out<<buffer;
} else if (countline == 24) {
buffer.erase (1,19);
out<<buffer<<endl;
}
else
buffer.clear();
countline++;
}
in2.close();
out.close();
}