/* The main program uses the class Generate to generate random numbers with either
   a Gaussian or a Poisson distribution.  The input is from the user, on which 
   distribution to be generated along with the particular parameters to generate that
   distribution.  The output is to a file, which was named by the user.
   
   The format of the data file produced is a single column of numbers.  The first number
   is the number of random numbers that were generated.  The number is provided by the
   user.  And the rest of the numbers in the column are the actual set of numbers that
   are generated.
   
   Note in order to compile Generate.C you need to have the following files in the same
   directory:  Generate.h,  SpecialFunction.h.
*/   


#include <iostream.h>
#include <fstream.h>
#include "Generate.h"

void main() {

  // Inputs from user the number of random numbers to be produced and the name of the
  // output file to be created.

     Generate num;               // num is defined as an object Generate.  This prompts
     			    // the constructor in Generate an enables the program to
     			    // use the member functions contained in the class.

     cout<<"How many numbers to you want to produce? ";
     long number;cin>>number;
     cout<<endl;
     
     cout<<"Input the filename for the output"<<endl;
     char file[30];cin>>file;

  // Choice of which distribution.
     
     cout<<endl;	
     cout<<"Which distribution do you want to produce? Choose one of the following."<<endl;
     cout<<endl;
     cout<<"Gaussian distribution (g)"<<endl;
     cout<<"Poisson distribution  (p)"<<endl;
     char choice;cin>>choice;
     
     if (choice == 'g') {
     
     	cout<<endl;
          cout<<"Input the mean and the sigma of the gaussian distribution you want"<<endl;
          float mean;float sigma;
          cin>>mean>>sigma;	                   
   	cout<<endl;       				      
   
          ofstream out(file);		// Outputting to the file.
          out<<number<<endl;
          
          for(long i=0;i < number;i++) {
   
              out<<num.Gaussian(mean,sigma)<<endl;    	//Gaussian function is called to produce
          					//of course a Gaussian distribution.
          }
     }
     
     if (choice == 'p') {				//Same thing now for Poisson distribution
     
   	cout<<endl;
          cout<<"Input the mean of the poisson distribution :";
          float mean;cin>>mean;
          cout<<endl;
          
          ofstream out(file);                	 
          out<<number<<endl;			
          for(long i=0;i < number;i++) {	
          					
               out<<num.Poisson(mean)<<endl;	
               
      }
 }     
}