Click HERE to return home



Click HERE to return to the Final Report Web Page


























































Created by Dia Lewis and Lauren Webb

C++ Code
File: migration.C

#include[iostream.h]
#include[fstream.h]
#include[stdlib.h]
#include[time.h]

int main()
{

unsigned seed=time(NULL);
srand(seed);
float temp_rand = RAND_MAX, r1 = 1./3., r2 = 2./3.;
int rxint, ryint;

ofstream movedata1;
movedata1.open("movedata1.dat");

for (int j=1; j<=3; j++){

int xold = 0, xnew = 0, yold = 0, ynew = 0;
int TimeIterations = 100;

for (int i=0; i
{
float rx=rand()/temp_rand;
float ry=rand()/temp_rand;

if (rx <= r1) rxint = -1;
else if (rx <= r2) rxint = 0;
else rxint = 1;
xnew = xold + rxint;

if (ry <= r1) ryint = -1;
else if (ry <= r2) ryint = 0;
else ryint =1;
ynew = yold + ryint;

movedata1 << xold << ", " << yold << endl;
movedata1 << xnew << ", " << ynew << endl;
xold = xnew;
yold = ynew;


}
cout << endl;
}
return(0);
}


To return to the home page click here

To return to the Final Report page click here