Cod sursa(job #679664)

Utilizator Stefex09Stefan Teodorescu Stefex09 Data 13 februarie 2012 17:10:43
Problema A+B Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.79 kb
#include<fstream>
#include<vector>
#include<iostream>
using namespace std;
vector<long long> v1;
vector<long long>::iterator it;
namespace fisiere
{
	ifstream in("adunare.in");
	ofstream out("adunare.out");
}
	
class suma{
private:
	long long *a,*b;
public:
	inline void set_values(long long,long long);
	inline long long sumax();
	inline void del(){delete a;delete b;};
	suma();
};
inline void suma::set_values(long long x,long long y){
	a=new long long;*a=x;
	b=new long long;*b=y;
	v1.push_back(*a);
	v1.push_back(*b);
}
inline long long suma::sumax(){
	long long suma=0;
	for(it=v1.begin();it<v1.end();it++)
		suma+=*it;
	return suma;
}
suma::suma()
{
	long long c,d;
	fisiere::in>>c>>d;
	set_values(c,d);
	fisiere::out<<sumax();
	del();
}
int main()
{
	suma x;
	return 0;
}