Pagini recente » Cod sursa (job #1316685) | Cod sursa (job #372314) | Cod sursa (job #2271391) | Cod sursa (job #829556) | Cod sursa (job #1202771)
#include <iostream>
#include <fstream>
#include <cstdlib>
using std::string;
using std::ifstream;
using std::ofstream;
typedef struct Pair {
unsigned a;
unsigned b;
} Pair;
void read_input(Pair& input, string path) {
ifstream file;
string line;
file.open(path.c_str());
getline(file, line);
input.a = atoi(line.c_str());
getline(file, line);
input.b = atoi(line.c_str());
file.close();
}
void write_outut(int sum, string path) {
ofstream file;
file.open(path.c_str());
file << sum << std::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;
}