


//  MAIN.CC    

typedef enum boolean {FALSE,TRUE} BOOLEAN;   //  Have to make our own BOOLEAN type for C/C++ 

#include <iostream.h>
#include <fstream.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

void main() {
       char tempchar;
       int i,j,k,numchroms,chromlength;
       FILE *out;

       cout << "\n\n ********************************************************* \n";
       cout << "RANDOM CHROMOSOME GENERATOR (outputs to file named `input')";
       cout << "\n\n ********************************************************* \n";
       cout << "\n\n How many chromosomes? ";
       cin >> numchroms;
       cout <<  "\n How many bits per chromosome? ";
       cin >> chromlength;
       cout << "\n";
  
       out = fopen("input","w"); 
       for(k = 0; k < numchroms; k++)
       {
       for (i = 0; i < chromlength; i++)
           {
               j =  rand() % 2;
               fprintf(out,"%c",'0'+j);
           };
       fprintf(out,"\n");
        }
       fprintf(out,"\n");
       fclose(out);
       cout << "done\n";
  }


