Cod sursa(job #2338468)
Utilizator | Data | 7 februarie 2019 15:18:58 | |
---|---|---|---|
Problema | A+B | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main () {
string line;
ifstream f("adunare.in");
ofstream g ("adunare.out");
int sum=0;
int x;
f>>x;
if (f.good())
{
while ( getline (f,line) )
{
sum = sum+x;
f>>x;
}
g<<sum<<"\n";
f.close();
g.close();
}
return 0;
}