Skip to content

Instantly share code, notes, and snippets.

@anden3
Created October 27, 2017 14:46
Show Gist options
  • Select an option

  • Save anden3/46e7e85d02ca0ac1bd97f895b3290947 to your computer and use it in GitHub Desktop.

Select an option

Save anden3/46e7e85d02ca0ac1bd97f895b3290947 to your computer and use it in GitHub Desktop.
#include <fstream>
using namespace std;
int main() {
ifstream input1("input1.txt"); // in fstream, läser ett textdokument
ifstream input2("input2.txt");
ofstream output("output.txt"); // out fstream, skapar och öppnar ett textdokument
while (!(input1.eof() || input2.eof())) {
int a, b;
input1 >> a;
input2 >> b;
output << a + b << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment