0
例如,我不得不矩陣無法檢測到任何錯誤,但我的程序掛起
Allocation Matrix
0 0 1 0
2 0 0 1
0 1 2 0
Request matrix
2 0 0 1
1 0 1 0
2 1 0 0
Resources in Existence: 4 2 3 1
Available resources: 2 1 0 0
我的代碼
for (w = 0; w < TRows;)
{
if (Finish[w] == 0)
{
flag = 0;
for (x = 0; x < TColumns; x++)
{
if (A[x] >= Request[w, x])
flag = flag + 1;
}
if (flag == TColumns)
{
T[y] = w;
Finish[w] = 1;
for (x = 0; x < TRows; x++)
{
A[x] = A[x] + Allocation[w, x];
}
y = y + 1;
w = -1;
//break;
}
w++;
}
}
你一定要用調試器完成它。 – Artemiy 2010-12-06 17:54:35