void CPU::add(int x)//adds value to RR schedular
{
for(int i=0; i<=9; i++) // locate last value of ready array
{
if(ready[i]==0)//if it is the last entry add the value
{
ready[i]=x;
break;
}
}
}
This method is causing me issues. The ready array stores int values that are above 0. When i want to add a value to the ready array i have to pass it though this method, which locates the first 0 value and replaces it with the value that was passed in. The problem is when i have ready[0] set to anything, such at 20, ready[i]==0 still says that 20 is equal to 0. I can post the entire code and data file but its about 3000 lines so i will not unless its needed.
EDIT: The Ready array has 10 elements (0 - 9). Here is the link to the whole code http://goo.gl/1fsG1f
Aucun commentaire:
Enregistrer un commentaire