#include <iostream>
#include<ctime>
#include <cstdlib>
#include<fstream>
using namespace std;
int main()
{
int **alpop;
int i,rand_index,p,pop;
int *chrom,temp,job;
cout<<"enter population size";
cin>>pop;
cout<<"enter no of jobs";
cin>>job;//enter chromosom size
chrom=new int[job];//dynamic memory allocation
alpop=new int *[job];
for(int lp=0;lp<pop;lp++)
alpop[lp]=new int[pop];
ofstream outfile("C:\\fuad2.OUT");
outfile<<"population size:"<<pop<<endl;
outfile<<"no of jobs:"<<job<<endl;
srand(unsigned (time(0)));
for(p=0;p<pop;p++)
{
for(i=0;i<job;i++)
{
rand_index=(rand()%(job-1))+1;//swapping operation
temp=chrom[rand_index];
chrom[rand_index]=chrom[i];
chrom[i]=temp;
alpop[p][i]=chrom[i]; //I donn't understand why the program creats error in debug when coming to that line
}