Ok I am trying to figure out the likelihood of a 'gene' becoming the 'parent' of the 'next generation' in my genetic algorithm program and everything compiles fine and outputs fint up till figuring out the percent of the very last 'chromosome' for some reason it gives me a output that isn't even a decimal.I have tried making the for loop go once more through and that still gives me a wrong awsner on the last ones. I have no idea what I did wrong but I have narrowed it down to a problem within my chances() funtion. I'll comment rite beside where the error seems to be occuring
Code:int chances() { float suminverse; suminverse=1/fitnesslvls[0]+1/fitnesslvls[1]+1/fitnesslvls[2]+1/fitnesslvls[3]+1/fitnesslvls[4]; cout<<"\n\n The Sum Of Ths Multiplicative Inverses= "<<suminverse<<"\n"; for (int t=0;t<=4;t++)//in this for loop but only on the las time. {liklihood[t]=1/fitnesslvls[t]/suminverse; cout<<"The Likelihood Of Chromosome "<<t<<" Being Picked= "<<liklihood[t]<<"\n"; } }