Pagini recente » Cod sursa (job #2998659) | Cod sursa (job #1453682) | Cod sursa (job #180685) | Cod sursa (job #2916782) | Cod sursa (job #1779651)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("adunare.in");
ofstream fout("adunare.out");
string buffer;
string::iterator buffer_it;
int read_int(int &x) {
while ( *buffer_it < '0' || *buffer_it > '9' ) {
++ buffer_it;
}
x = 0;
while ( *buffer_it >= '0' && *buffer_it <= '9' ) {
x = x*10+*buffer_it - '0';
++ buffer_it;
}
return x;
}
int main( ) {
getline(fin, buffer, (char)0);
buffer_it = buffer.begin();
fout << buffer << "\n";
int x, y;
x = read_int(x);
y = read_int(y);
fout << x+y << "\n";
return 0;
}