fixing bugs in replacers and moving some code between files

This commit is contained in:
gustavo 1999-09-21 18:14:39 +00:00
commit bc9638f53c
7 changed files with 89 additions and 103 deletions

View file

@ -3,6 +3,8 @@
// (c) GeNeura Team 1998
//-----------------------------------------------------------------------------
#include <time.h> // time
#include <stdlib.h> // srand, rand
#include <iostream> // cout
#include <eo> // eoFitness
@ -11,6 +13,9 @@
class eoFloat: public eoFitness
{
public:
eoFloat(const float x) { fitness = x; }
eoFloat(const int x) { fitness = static_cast<float>(x); }
bool operator<(const eoFitness& other) const
{
const eoFloat& x = (const eoFloat&) other;
@ -40,8 +45,13 @@ private:
main()
{
eoFloat a, b;
srand(time(0));
eoFloat a = static_cast<float>(rand()) / RAND_MAX,
b = static_cast<float>(rand()) / RAND_MAX;
cout.precision(2);
unsigned repeat = 2;
while (repeat--)
{
@ -62,7 +72,7 @@ main()
if (a == b)
cout << a << " == " << b << " is true" << endl;
else
cout << a << " == " << b << " is false" <<endl;
cout << a << " == " << b << " is false" <<endl;
cout << "testing != ";
if (a != b)