@born2c0de
thanks
the code below is a continuation from the code in this topic
http://www.dreamincode.net/forums/showtopic23709.htmCODE
Private Sub Command2_Click()
Dim i
Dim mem As Integer
Dim marker As Integer
mem = 0
Do While Not mem = 64
For i = 1 To size
'memory size of job is <=4K
If grid.TextMatrix(i, 3) <= 4 And marker = 0 Then
Label2(6).Caption = "Job " & grid.TextMatrix(i, 0)
marker = marker + 1
mem = mem + 4
'End If
ElseIf grid.TextMatrix(i, 3) <= 4 And marker = 1 Then
Label2(5).Caption = "Job " & grid.TextMatrix(i, 0)
marker = marker + 1
mem = mem + 4
'End If
'memory size of job is <=8k
ElseIf grid.TextMatrix(i, 3) <= 8 And marker = 2 Then
Label2(4).Caption = "Job " & grid.TextMatrix(i, 0)
marker = marker + 1
mem = mem + 8
'End If
ElseIf grid.TextMatrix(i, 3) <= 8 And marker = 3 Then
Label2(3).Caption = "Job " & grid.TextMatrix(i, 0)
marker = marker + 1
mem = mem + 8
'End If
If grid.TextMatrix(i, 3) <= 8 And marker = 4 Then
Label2(2).Caption = "Job " & grid.TextMatrix(i, 0)
marker = marker + 1
mem = mem + 8
End If
'memory size of job is <=16K
ElseIf grid.TextMatrix(i, 3) <= 16 And marker = 5 Then
Label2(1).Caption = "Job " & grid.TextMatrix(i, 0)
marker = marker + 1
mem = mem + 16
'End If
ElseIf grid.TextMatrix(i, 3) <= 16 And marker = 6 Then
Label2(0).Caption = "Job " & grid.TextMatrix(i, 0)
marker = marker + 1
mem = mem + 16
End If
Next
Loop
End Sub
im having a hard time with my cpu algorithm's memory management..
i have to display the jobs to my memory(which i represented with labels) according to sizes; two 16k memory, three 8k, and two 4k. the jobs memory size range from 1K to 16K
the code displays the jobs but there are repititions and sometimes wrong memory size, i think the problem is with my arrays.....
can someone help me fix my code...
This post has been edited by pau-pau: 13 Feb, 2007 - 12:59 AM