Skip to content

Instantly share code, notes, and snippets.

@astamatto
Created March 31, 2017 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astamatto/5d8a87ee03db94af3c6fdc9400c2bf74 to your computer and use it in GitHub Desktop.
Save astamatto/5d8a87ee03db94af3c6fdc9400c2bf74 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
string linha; //variável para onde leremos cada linha
for (int i = 1; i <= 5; ++i) { //1.txt 2.txt 3.txt 4.txt 5.txt
cout << "Arquivo " << i << "\n";
ifstream arq("arquivos/" + to_string(i) + ".txt");
while ( getline(arq, linha) ) {
cout << linha << "\n";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment