JDFX888 JDFX888
关注数: 87 粉丝数: 89 发帖数: 6,534 关注贴吧数: 37
这个程序为什么会10047错误 如题 winsock 10047错误 用的是UDP协议 Dim data(7) As Byte Dim i As Integer Dim X As Integer Dim Y As Integer Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Command3_Click() End Sub Private Sub Check1_Click() If X <> 1 Then X = 1 Timer1.Enabled = True Else X = 0 Timer1.Enabled = False End If End Sub Private Sub Check2_Click() If Y <> 1 Then Y = 1 Else Y = 0 End If End Sub Private Sub Command1_Click() Winsock1.LocalPort = 50236 Winsock1.RemotePort = 88 data(0) = &H7E data(1) = &H4 data(2) = &H0 data(3) = &HF6 data(4) = &H1 data(5) = &H1 data(6) = &H8C Winsock1.SendData data Winsock1.Close End Sub Private Sub Command2_Click() Winsock1.LocalPort = 51236 Winsock1.RemotePort = 88 data(0) = &H7E data(1) = &H4 data(2) = &H0 data(3) = &HF5 data(4) = &H1 data(5) = &H1 data(6) = &H8F Winsock1.SendData data Winsock1.Close End Sub Private Sub Form_Load() X = 0 Y = 0 End Sub Private Sub Label5_Click() End Sub Private Sub Timer1_Timer() If Hour(Time) = Text1.Text And Minute(Time) = Text2.Text And X = 1 Then data(0) = &H7E data(1) = &H4 data(2) = &H0 data(3) = &HF6 data(4) = &H1 data(5) = &H1 data(6) = &H8C Winsock1.SendData data Winsock1.Close End If If Hour(Time) = Text4.Text And Minute(Time) = Text5.Text And X = 1 Then data(0) = &H7E data(1) = &H4 data(2) = &H0 data(3) = &HF5 data(4) = &H1 data(5) = &H1 data(6) = &H8F Winsock1.SendData data Winsock1.Close End If End Sub Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean) End Sub 在VB里面调试的时候第一次不会 但是关掉VB再开第二次就会....然后在出错后在VB中改下localport后又不会,随便改都行,哪怕改的前后是一模一样的...编译出来之后有的机子上会有的机子上不会......
求解为什么代码中得 test函数为啥没起作用 var head,tail:integer; a,b,c:integer; ord:array[1..10000] of string; tmp:array[1..5] of integer; i:integer; data:array[1..1000] of integer; tmpstr1:string; tmpstr2:string; tmpstr3:string; istr:integer; k,j,l:integer; d,e,f:array[1..10000] of integer; Procedure output; begin writeln(d[tail],e[tail],f[tail]); end; Function test(z:integer;v:integer;q:integer):Boolean; begin if(z=5) and (v=5) then test:=true; if(z=5) and (q=5) then test:=true; if(v=5) and (q=5) then test:=true; end; Function check(p:string):boolean; var t:integer; begin check:=false; for t:=1 to tail-1 do begin if p=ord[t] then begin check:=true; break; end; end; end; Procedure bfs; begin repeat head:=head+1; For i:=1 to 6 do begin case i of 1:begin if e[head]<b then begin tail:=tail+1; if d[head]+e[head]>7 then e[tail]:=7 else e[tail]:=d[head]+e[head]; d[tail]:=d[head]-(b-e[head]); if d[tail]<0 then d[tail]:=0; f[tail]:=f[head]; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 2:begin if f[head]<c then begin tail:=tail+1; if d[head]+f[head]>3 then f[tail]:=3 else f[tail]:=d[head]+f[head]; d[tail]:=d[head]-(c-f[head]); if d[tail]<0 then d[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 3:begin if d[head]<a then begin tail:=tail+1; if d[head]+e[head]>10 then d[tail]:=10 else d[tail]:=d[head]+e[head]; e[tail]:=e[head]-(a-d[head]); if e[tail]<0 then e[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 4:begin if f[head]<c then begin tail:=tail+1; if f[head]+e[head]>3 then f[tail]:=3 else f[tail]:=f[head]+e[head]; e[tail]:=e[head]-(c-f[head]); if e[tail]<0 then e[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 5:begin if e[head]<b then begin tail:=tail+1; if f[head]+e[head]>7 then e[tail]:=7 else e[tail]:=f[head]+e[head]; f[tail]:=f[head]-(b-e[head]); if f[tail]<0 then f[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 6:begin if d[head]<a then begin tail:=tail+1; if d[head]+f[head]>10 then d[tail]:=10 else d[tail]:=d[head]+f[head]; f[tail]:=f[head]-(a-d[head]); if f[tail]<0 then f[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; end; end; until head>=tail; end; begin a:=10; b:=7; c:=3; d[1]:=10; e[1]:=0; f[1]:=0; head:=0; tail:=1; bfs; output; end.
帮我看看为啥test函数不起作用 var head,tail:integer; a,b,c:integer; ord:array[1..10000] of string; tmp:array[1..5] of integer; i:integer; data:array[1..1000] of integer; tmpstr1:string; tmpstr2:string; tmpstr3:string; istr:integer; k,j,l:integer; d,e,f:array[1..10000] of integer; Procedure output; begin writeln(d[tail],e[tail],f[tail]); end; Function test(z:integer;v:integer;q:integer):Boolean; begin if(z=5) and (v=5) then test:=true; if(z=5) and (q=5) then test:=true; if(v=5) and (q=5) then test:=true; end; Function check(p:string):boolean; var t:integer; begin check:=false; for t:=1 to tail-1 do begin if p=ord[t] then begin check:=true; break; end; end; end; Procedure bfs; begin repeat head:=head+1; For i:=1 to 6 do begin case i of 1:begin if e[head]<b then begin tail:=tail+1; if d[head]+e[head]>7 then e[tail]:=7 else e[tail]:=d[head]+e[head]; d[tail]:=d[head]-(b-e[head]); if d[tail]<0 then d[tail]:=0; f[tail]:=f[head]; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 2:begin if f[head]<c then begin tail:=tail+1; if d[head]+f[head]>3 then f[tail]:=3 else f[tail]:=d[head]+f[head]; d[tail]:=d[head]-(c-f[head]); if d[tail]<0 then d[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 3:begin if d[head]<a then begin tail:=tail+1; if d[head]+e[head]>10 then d[tail]:=10 else d[tail]:=d[head]+e[head]; e[tail]:=e[head]-(a-d[head]); if e[tail]<0 then e[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 4:begin if f[head]<c then begin tail:=tail+1; if f[head]+e[head]>3 then f[tail]:=3 else f[tail]:=f[head]+e[head]; e[tail]:=e[head]-(c-f[head]); if e[tail]<0 then e[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 5:begin if e[head]<b then begin tail:=tail+1; if f[head]+e[head]>7 then e[tail]:=7 else e[tail]:=f[head]+e[head]; f[tail]:=f[head]-(b-e[head]); if f[tail]<0 then f[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; 6:begin if d[head]<a then begin tail:=tail+1; if d[head]+f[head]>10 then d[tail]:=10 else d[tail]:=d[head]+f[head]; f[tail]:=f[head]-(a-d[head]); if f[tail]<0 then f[tail]:=0; str(d[tail],tmpstr1); str(d[tail],tmpstr1); str(d[tail],tmpstr1); ord[tail]:=tmpstr1+tmpstr2+tmpstr3; check(ord[tail]); if check(ord[tail])=true then begin ord[tail]:='0'; tail:=tail-1; end; end; test(d[tail],e[tail],f[tail]); if test(d[tail],e[tail],f[tail])=true then begin writeln('yes'); break; end; end; end; end; until head>=tail; end; begin a:=10; b:=7; c:=3; d[1]:=10; e[1]:=0; f[1]:=0; head:=0; tail:=1; bfs; output; end.
1 下一页