adding examples for eoBin & other stuff
This commit is contained in:
parent
50062e7c30
commit
0f4ff4691c
10 changed files with 1306 additions and 0 deletions
77
eo/test/t-eofitness.cpp
Normal file
77
eo/test/t-eofitness.cpp
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// t-eofitness.cpp
|
||||
// (c) GeNeura Team 1998
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <iostream> // cout
|
||||
#include <eo> // eoFitness
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class eoFloat: public eoFitness
|
||||
{
|
||||
public:
|
||||
bool operator<(const eoFitness& other) const
|
||||
{
|
||||
const eoFloat& x = (const eoFloat&) other;
|
||||
return fitness < x.fitness;
|
||||
}
|
||||
|
||||
operator float() const
|
||||
{
|
||||
return fitness;
|
||||
}
|
||||
|
||||
void printOn(ostream& os) const
|
||||
{
|
||||
os << fitness;
|
||||
}
|
||||
|
||||
void readFrom(istream& is)
|
||||
{
|
||||
is >> fitness;
|
||||
}
|
||||
|
||||
private:
|
||||
float fitness;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
main()
|
||||
{
|
||||
eoFloat a, b;
|
||||
|
||||
unsigned repeat = 2;
|
||||
while (repeat--)
|
||||
{
|
||||
cout << "------------------------------------------------------" << endl;
|
||||
cout << "testing < ";
|
||||
if (a < b)
|
||||
cout << a << " < " << b << " is true" << endl;
|
||||
else
|
||||
cout << a << " < " << b << " is false" <<endl;
|
||||
|
||||
cout << "testing > ";
|
||||
if (a > b)
|
||||
cout << a << " > " << b << " is true" << endl;
|
||||
else
|
||||
cout << a << " > " << b << " is false" <<endl;
|
||||
|
||||
cout << "testing == ";
|
||||
if (a == b)
|
||||
cout << a << " == " << b << " is true" << endl;
|
||||
else
|
||||
cout << a << " == " << b << " is false" <<endl;
|
||||
|
||||
cout << "testing != ";
|
||||
if (a != b)
|
||||
cout << a << " != " << b << " is true" << endl;
|
||||
else
|
||||
cout << a << " != " << b << " is false" <<endl;
|
||||
|
||||
a = b;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Loading…
Add table
Add a link
Reference in a new issue