ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

½Ð°Ý¤°»ò¦a¤è¿ù¤F

½Ð°Ý¤°»ò¦a¤è¿ù¤F

Public i As Integer
Public m As Integer
Public n As Integer
Public B As Integer
Public S As Integer
Dim buyArray(99) As Single
Dim sellArray(99) As Single
Private Sub CommandButton1_Click()
B = 1
i = i + 1
        Sheets("sheet1").Cells(i, 1) = "¶R"
        Sheets("sheet1").Cells(i, 2) = Int((10 * Rnd) + 1)
m = m + 1
buyArray(m) = Sheets("sheet1").Cells(i, 2)
If B = S Then
    If m > n Then
    Sheets("sheet1").Cells(i, 3) = sellArray(n) - buyArray(n)
    S = 0
    Else
    Sheets("sheet1").Cells(i, 3) = sellArray(m) - buyArray(m)
    B = 0
    End If
   
End If


End Sub

Private Sub CommandButton2_Click()
S = 1
i = i + 1
        Sheets("sheet1").Cells(i, 1) = "½æ"
        Sheets("sheet1").Cells(i, 2) = Int((10 * Rnd) + 1)
n = n + 1
sellArray(n) = Sheets("sheet1").Cells(i, 2)
If S = B Then
    If n > m Then
    Sheets("sheet1").Cells(i, 3) = sellArray(m) - buyArray(m)
    B = 0
    Else
    Sheets("sheet1").Cells(i, 3) = sellArray(n) - buyArray(n)
    S = 0
    End If
   
End If
End Sub

¥»©«³Ì«á¥Ñ cdkee ©ó 2010-9-27 15:40 ½s¿è

¥Î¥H¤Wªºµ{¦¡¡A¨ä¤¤ªºµ²ªG...sample a)¬Ý¤£¨ì¦³°ÝÃD¡Asample b)°ÝÃD¥X²{¦b­«½Æ¤F¤W¤@­Ó¥­­Üªº·l¯qÃB!
sample a)
¶R 8
½æ 6 -2
¶R 6
½æ 3 -3
¶R 4
½æ 8 4
¶R 1
½æ 8 7
¶R 9
½æ 8 -1

sample b)
¶R 8
¶R 6
¶R 6
½æ 3 -5
¶R 4
½æ 8 2
½æ 1 -5
½æ 8 4
½æ 9 4
½æ 8

TOP

¥»©«³Ì«á¥Ñ et5323 ©ó 2010-9-27 15:40 ½s¿è

¯à运¦æ,没发现¦³¤°¤\问题ªº¹À.

TOP

¨C·í¥þ³¡ªº¶R©Î½æ¥­­Ü¤F¡A¤§«á·sªº¤@­Ó¶R©Î½æ¡A¥u­n¸ò¤W¤@­Ó¶R½æ¤è¦V¬Û¦P¡A´N·|¥X²{¤F¤W¤@­Ó¥­­Üªº·l¯qÃB!

TOP

¯à运¦æ,没发现¦³¤°¤\问题ªº¹À.
et5323 µoªí©ó 2010-9-27 15:38



    sample b)°ÝÃD¥X²{¦b­«½Æ¤F¤W¤@­Ó¥­­Üªº·l¯qÃB!

TOP

¨S¤H¬Ý±o¨ì§Aªº¤å¥ó¡A¦Û¦æ°£¿ù§a¡I

TOP

¨S¤H¬Ý±o¨ì§Aªº¤å¥ó...
oobird µoªí©ó 2010-9-27 22:20



    ¨S¤å¥óªº¡Aµ{¦¡¤w¼g¦b1#.

TOP

¬Ý¤£¥X¨Ó§Aªº·l¯qÃB¬O¤°»ò¡A¤£¹L·Pı§A¶·­n¦b²£¥Í¶Ã¼Æ«e¥[¤WRandomize

TOP

¬Ý¤£¥X¨Ó§Aªº·l¯qÃB¬O¤°»ò¡A¤£¹L·Pı§A¶·­n¦b²£¥Í¶Ã¼Æ«e¥[¤WRandomize
oobird µoªí©ó 2010-9-27 22:56


·l¯qÃB«ü¤@¶R¤@½æ«áªº·l¯q.
"­n¦b²£¥Í¶Ã¼Æ«e¥[¤WRandomize"---ª©¤j¥i§_¦³¨Ò¤l¦A»¡©ú?ÁÂÁÂ!

TOP

Sheets("sheet1").Cells(i, 1) = "¶R"
Randomize
        Sheets("sheet1").Cells(i, 2) = Int((10 * Rnd) + 1)

TOP

        ÀR«ä¦Û¦b : ¤Hªº²´·úªø¦b«e­±¡A¥u¬Ý¨ì§O¤Hªº¯ÊÂI¡Aµ·²@¬Ý¤£¨ì¦Û¤vªº¯ÊÂI¡C
ªð¦^¦Cªí ¤W¤@¥DÃD