Cod sursa(job #3251792)
| Utilizator | Data | 26 octombrie 2024 23:41:23 | |
|---|---|---|---|
| Problema | A+B | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.61 kb |
#include <fstream>
#include <iostream>
using namespace std;
int main() {
ifstream fin("adunare.in");
ofstream fout("adunare.out");
if (!fin.is_open()) {
cerr << "Error: Could not open input file." << endl;
return 1;
}
if (!fout.is_open()) {
cerr << "Error: Could not open output file." << endl;
return 1;
}
int a, b;
fin >> a >> b;
if (fin.fail()) {
cerr << "Error: Failed to read integers from input file." << endl;
return 1;
}
fout << a + b;
fin.close();
fout.close();
return 0;
}