Cod sursa(job #1202772)

Utilizator the_architectSzeredi Tibor Zoltan the_architect Data 29 iunie 2014 15:17:39
Problema A+B Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <iostream>
#include <fstream>
#include <cstdlib>

using std::string;
using std::endl;
using std::ifstream;
using std::ofstream;


typedef struct Pair {
  unsigned a;
  unsigned b;
} Pair;


void read_input(Pair& input, string path) {
  ifstream file;

  file.open(path.c_str());

  file >> input.a;
  file >> input.b;

  file.close();
}

void write_outut(int sum, string path) {
  ofstream file;

  file.open(path.c_str());
  file << sum << endl;
  file.close();
}

int main(int argc, char *argv[]) {
  Pair input;

  read_input(input, "adunare.in");
  write_outut(input.a + input.b, "adunare.out");

  return 0;
}