/*
*/
#ifndef WEIGHT_CC
#define WEIGHT_CC
#include <float.h>
#include <iostream.h>
#include <iomanip.h>
class weight {
double weight_double;
public:
weight()
{
weight_double = DBL_MAX;
}
weight( double d )
{
weight_double = d;
}
double getweight()
{
return weight_double;
}
void setweight( double D )
{
weight_double = D;
}
void setweight( weight W )
{
weight_double = W.weight_double;
}
void add( double P )
{
weight_double += P;
} // add
void add( weight P )
{
add( P.weight_double );
} // add
void subtract( double P)
{
weight_double -= P;
} // -=
void subtract( weight P)
{
subtract( P.weight_double );
} // subtract
// overloads
bool operator==( const weight &E )
{
return (weight_double == E.weight_double);
} // ==
bool operator==( const double &E )
{
return (weight_double == E);
} // ==
void operator=( const weight &E )
{
weight_double = E.weight_double;
} // =
void operator=( const double &E )
{
weight_double = E;
} // =
bool operator!=( const weight &E )
{
return (weight_double != E.weight_double);
} // !=
bool operator<( const weight &E )
{
return (weight_double < E.weight_double);
} // <
bool operator<( const double &E )
{
return (weight_double < E);
} // <
bool operator>( const weight &E )
{
return (weight_double > E.weight_double);
} // >
bool operator>( const double &E )
{
return (weight_double > E);
} // >
void OutPut()
{
cout.left;
cout << setiosflags( ios::showpoint );
cout << setiosflags( ios::fixed );
cout << weight_double;
}
}; // weight.cc
#endif