Pagini recente » Cod sursa (job #1550520) | Cod sursa (job #1360233) | Cod sursa (job #2434492) | Cod sursa (job #1000990) | Cod sursa (job #3220085)
#include <fstream>
#include <algorithm>
#include <cmath>
using namespace std;
ifstream fin("data.in");
ofstream fout("data.out");
const double margin = 0.000001;
class Real
{
public:
double val;
operator double();
template<class T> operator T();
template<class T> void operator=(T val);
template<class T> bool operator==(T val);
template<class T> bool operator>(T val);
template<class T> bool operator>=(T val);
template<class T> bool operator<(T val);
template<class T> bool operator<=(T val);
};
int cmpD(double x, double y);
int main()
{
Real x[3], y[3];
fin >> x[0].val >> y[0].val >> x[1].val >> y[1].val >> x[2].val >> y[2].val;
fout << x[0];
return 0;
}
int cmpD(double x, double y)
{
if(abs(x-y) < margin) return 0;
if(x-y < margin) return -1;
return 1;
}
Real::operator double()
{
return this->val;
}
template<class T> Real::operator T()
{
return static_cast<T>(this->val);
}
template<class T> void Real::operator=(T val)
{
this->val = static_cast<double>(val);
}
template<class T> bool Real::operator==(T val)
{
return cmpD(this->val, static_cast<double>(val)) == 0;
}
template<class T> bool Real::operator>(T val)
{
return cmpD(this->val, static_cast<double>(val)) > 0;
}
template<class T> bool Real::operator>=(T val)
{
return cmpD(this->val, static_cast<double>(val)) >= 0;
}
template<class T> bool Real::operator<(T val)
{
return cmpD(this->val, static_cast<double>(val)) < 0;
}
template<class T> bool Real::operator<=(T val)
{
return cmpD(this->val, static_cast<double>(val)) <= 0;
}