Pagini recente » Cod sursa (job #1870426) | Cod sursa (job #949994) | Cod sursa (job #2697581) | Cod sursa (job #2639057) | Cod sursa (job #1202772)
#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;
}