I am writing a program to simulate the Hardy-Weinberg principle (a biology theory about how allelic frequencies should stay the same within a population given...), but my question isn't about the principle. It is about a for loop I use in the program to simulate the selection of finding a mate and then the mating process (don't get any ideas, its a command line program, no graphics). I have it set to run the number of times the user specifies, but I was hoping to be able to give the user some sort of feedback as to how many mating processes have occured. To such ends I wrote this for loop:
//numbertimes is a value the user entered
for(int k=0; k<numbertimes; k++)
{
selectmate(creat, matematrix); //finds the mates
mateagainst(creat, matematrix, choice); //mates the organisms
if(k%5==0) //heres the problem
{
cout << " " << k << " ";
}
}
When I compile and run the program, I expect a nice list to slowly appear of the number of mating processes that have been completed. Instead the computer holds off and sends the entire list of numbers indicating the number of matings completed at once. I have tried it on several different computers and I get the same thing each time. Now I'm not sure if this is some problem with my compiler (I use DJGPP), but I was hoping some of you may have some insight into why I get the entire list at once. If there is anything else you need to know, go ahead and ask. Thanks
Decoy
//numbertimes is a value the user entered
for(int k=0; k<numbertimes; k++)
{
selectmate(creat, matematrix); //finds the mates
mateagainst(creat, matematrix, choice); //mates the organisms
if(k%5==0) //heres the problem
{
cout << " " << k << " ";
}
}
When I compile and run the program, I expect a nice list to slowly appear of the number of mating processes that have been completed. Instead the computer holds off and sends the entire list of numbers indicating the number of matings completed at once. I have tried it on several different computers and I get the same thing each time. Now I'm not sure if this is some problem with my compiler (I use DJGPP), but I was hoping some of you may have some insight into why I get the entire list at once. If there is anything else you need to know, go ahead and ask. Thanks
Decoy