level 1
不知道自己编的怎样,请高手们赐教,谢谢啦!^__^我还有一个问题请教:用pascal猜数字编译成.exe应用程序,到最后输出完输赢情况后窗口立即自动关闭了,请问这个问题可以解决吗?var p,q:array[1..4]of byte; a,b,c,i,j,k:integer;f:boolean;begin writeln('Welcome-come in the game"guess numbers"!Enjoy yourself!'); randomize; f:=true; for i:=1 to 4 do p[i]:=random(10); while f=true do begin f:=false; for i:=1 to 4 do for j:=i-1 downto 1 do if p[i]=p[j] then begin f:=true; p[i]:=random(10); break; end; end; writeln('Please input the numbers'); for k:=1 to 8 do begin write(k,'. '); a:=0; b:=0; for i:=1 to 4 do read(q[i]); f:=true; while f=true do begin f:=false; for i:=1 to 3 do for j:=i-1 downto 1 do if q[i]=q[j] then begin writeln('Wrong numbers.Please reinput'); for c:=1 to 4 do read(q[c]); f:=true; break; end; end; for i:=1 to 4 do for j:=1 to 4 do if p[i]=q[j] then if i=j then a:=a+1 else b:=b+1; f:=false; if a<4 then writeln(' A',a,'B',b) else begin writeln(' You Win!'); f:=true; break; end; end; if f=false then begin writeln(' You lose!'); writeln('The numbers is:'); for i:=1 to 4 do write(p[i],' '); end;end.
2006年05月17日 13点05分
1
level 1
我又修改了一下:label 10;var p,q:array[1..4]of longint;ch:char; a,b,c,i,j,k:integer;f:boolean;begin10:writeln; writeln('Welcome-come in the game"guess numbers"!Enjoy yourself!'); randomize; f:=true; for i:=1 to 4 do p[i]:=random(10); while f=true do begin f:=false; for i:=1 to 4 do for j:=i-1 downto 1 do if p[i]=p[j] then begin f:=true; p[i]:=random(10); break; end; end; writeln; writeln('Please input the numbers,like "0 1 2 3"'); for k:=1 to 8 do begin write(k,'. '); a:=0; b:=0; for i:=1 to 4 do read(q[i]); f:=true; while f=true do begin f:=false; for i:=1 to 4 do begin if (q[i]>9)or(q[i]<0) then begin writeln('Wrong numbers.Please reinput'); write(' '); for c:=1 to 4 do read(q[c]); f:=true; break; end; for j:=i-1 downto 1 do if q[i]=q[j] then begin writeln('Wrong numbers.Please reinput'); write(' '); for c:=1 to 4 do read(q[c]); f:=true; break; end; end; end; for i:=1 to 4 do for j:=1 to 4 do if p[i]=q[j] then if i=j then a:=a+1 else b:=b+1; f:=false; if a<4 then writeln(' A',a,'B',b) else begin writeln(' **** **** **** *** ***** *****'); writeln(' **** ****** **** *** ***** ***'); writeln(' **** ******** **** *** ** ***'); writeln(' **** **** **** **** ***** *** ** ***'); writeln(' **** **** **** **** *** *** ** ***'); writeln(' ******* ******* *** *** ** ***'); writeln(' ***** ***** *** *** *****'); writeln(' *** *** ***** ***** *****'); writeln; f:=true; break; end; end; if f=false then begin writeln(' ********* *** * *'); writeln(' * * * * *'); writeln(' * * * *'); writeln(' ********* * * * *'); writeln(' * *********** * *'); writeln(' * * * * *'); writeln(' * * * * *'); writeln(' * * * * ***********'); writeln; writeln('The numbers is:'); writeln; write(' '); for i:=1 to 3 do write(p[i],' '); writeln(p[4]); writeln; end; writeln('type "q" to quit or type "r" to replay'); while (ch<>'q')and(ch<>'r') do readln(ch); if ch='r' then goto 10;end.
2006年05月19日 13点05分
4
level 1
label 10;var p,q:array[1..4]of longint;ch:char; a,b,c,i,j,k:integer;f:boolean;begin10:writeln; writeln('Welcome-come in the game"guess numbers"!Enjoy yourself!'); randomize; f:=true; for i:=1 to 4 do p[i]:=random(10); while f=true do begin f:=false; for i:=1 to 4 do for j:=i-1 downto 1 do if p[i]=p[j] then begin f:=true; p[i]:=random(10); break; end; end; writeln; writeln('Please input the numbers,like "0 1 2 3"'); for k:=1 to 8 do begin write(k,'. '); a:=0; b:=0; for i:=1 to 4 do read(q[i]); f:=true; while f=true do begin f:=false; for i:=1 to 4 do begin if (q[i]>9)or(q[i]<0) then begin writeln('Wrong numbers.Please reinput'); write(' '); for c:=1 to 4 do read(q[c]); f:=true; break; end; for j:=i-1 downto 1 do if q[i]=q[j] then begin writeln('Wrong numbers.Please reinput'); write(' '); for c:=1 to 4 do read(q[c]); f:=true; break; end; end; end; for i:=1 to 4 do for j:=1 to 4 do if p[i]=q[j] then if i=j then a:=a+1 else b:=b+1; f:=false; if a<4 then writeln(' A',a,'B',b) else begin writeln(' **** **** **** *** ***** *****'); writeln(' **** ****** **** *** ***** ***'); writeln(' **** ******** **** *** ** ***'); writeln(' **** **** **** **** ***** *** ** ***'); writeln(' **** **** **** **** *** *** ** ***'); writeln(' ******* ******* *** *** ** ***'); writeln(' ***** ***** *** *** *****'); writeln(' *** *** ***** ***** *****'); writeln; f:=true; break; end; end; if f=false then begin writeln(' ********* *** * *'); writeln(' * * * * *'); writeln(' * * * *'); writeln(' ********* * * * *'); writeln(' * *********** * *'); writeln(' * * * * *'); writeln(' * * * * *'); writeln(' * * * * ***********'); writeln; writeln('The numbers is:'); writeln; write(' '); for i:=1 to 3 do write(p[i],' '); writeln(p[4]); writeln; end; writeln('type "q" to quit or type "r" to replay'); while (ch<>'q')and(ch<>'r') do readln(ch); if ch='r' then goto 10;end.
2006年05月19日 13点05分
5
level 0
修改一下label 10; var p,q:array[1..4]of longint;ch:char; a,b,c,i,j,k:integer;f:boolean; begin repeatwriteln; writeln('Welcome-come in the game"guess numbers"!Enjoy yourself!'); randomize; f:=true; for i:=1 to 4 do p[i]:=random(10); while f=true do begin f:=false; for i:=1 to 4 do for j:=i-1 downto 1 do if p[i]=p[j] then begin f:=true; p[i]:=random(10); break; end; end; writeln; writeln('Please input the numbers,like "0 1 2 3"'); for k:=1 to 8 do begin write(k,'. '); a:=0; b:=0; for i:=1 to 4 do read(q[i]); f:=true; while f=true do begin f:=false; for i:=1 to 4 do begin if (q[i]>9)or(q[i]<0) then begin writeln('Wrong numbers.Please reinput'); write(' '); for c:=1 to 4 do read(q[c]); f:=true; break; end; for j:=i-1 downto 1 do if q[i]=q[j] then begin writeln('Wrong numbers.Please reinput'); write(' '); for c:=1 to 4 do read(q[c]); f:=true; break; end; end; end; for i:=1 to 4 do for j:=1 to 4 do if p[i]=q[j] then if i=j then a:=a+1 else b:=b+1; f:=false; if a<4 then writeln(' A',a,'B',b) else begin writeln(' **** **** **** *** ***** *****'); writeln(' **** ****** **** *** ***** ***'); writeln(' **** ******** **** *** ** ***'); writeln(' **** **** **** **** ***** *** ** ***'); writeln(' **** **** **** **** *** *** ** ***'); writeln(' ******* ******* *** *** ** ***'); writeln(' ***** ***** *** *** *****'); writeln(' *** *** ***** ***** *****'); writeln; f:=true; break; end; end; if f=false then begin writeln(' ********* *** * *'); writeln(' * * * * *'); writeln(' * * * *'); writeln(' ********* * * * *'); writeln(' * *********** * *'); writeln(' * * * * *'); writeln(' * * * * *'); writeln(' * * * * ***********'); writeln; writeln('The numbers is:'); writeln; write(' '); for i:=1 to 3 do write(p[i],' '); writeln(p[4]); writeln; end; writeln('type "q" to quit or type "r" to replay'); while (ch<>'q')and(ch<>'r') do readln(ch); until ch<>'r';end.
2008年07月02日 04点07分
7
level 4
Program ex1;Const infile = 'ex1.in'; outfile = 'ex1.out';Type p,q:array[1..4]of longint;var a,b,c,i,j,k:integer; f:boolean;ch:char; begin Assign(input, infile); Reset(input); Readln; repeat writeln; writeln('Welcome-come in the game"guess numbers"!Enjoy yourself!'); randomize; f:=true; for i:=1 to 4 do p[i]:=random(10); while f=true do begin f:=false; for i:=1 to 4 do for j:=i-1 downto 1 do if p[i]=p[j] then begin f:=true; p[i]:=random(10); break; end; end; writeln; writeln('Please input the numbers,like "0 1 2 3"'); for k:=1 to 8 do begin write(k,'. '); a:=0; b:=0; for i:=1 to 4 do read(q[i]); f:=true; while f=true do begin f:=false; for i:=1 to 4 do begin if (q[i]>9)or(q[i]<0) then begin writeln('Wrong numbers.Please reinput'); write(' '); for c:=1 to 4 do read(q[c]); f:=true; break; end; for j:=i-1 downto 1 do if q[i]=q[j] then begin writeln('Wrong numbers.Please reinput'); write(' '); for c:=1 to 4 do read(q[c]); f:=true; break; end; end; end; for i:=1 to 4 do for j:=1 to 4 do if p[i]=q[j] then if i=j then a:=a+1 else b:=b+1; f:=false; if a<4 then writeln(' A',a,'B',b) else begin writeln(' **** **** **** *** ***** *****'); writeln(' **** ****** **** *** ***** ***'); writeln(' **** ******** **** *** ** ***'); writeln(' **** **** **** **** ***** *** ** ***'); writeln(' **** **** **** **** *** *** ** ***'); writeln(' ******* ******* *** *** ** ***'); writeln(' ***** ***** *** *** *****'); writeln(' *** *** ***** ***** *****'); writeln; f:=true; break; end; end; if f=false then begin writeln(' ********* *** * *'); writeln(' * * * * *'); writeln(' * * * *'); writeln(' ********* * * * *'); writeln(' * *********** * *'); writeln(' * * * * *'); writeln(' * * * * *'); writeln(' * * * * ***********'); writeln; writeln('The numbers is:'); writeln; write(' '); for i:=1 to 3 do write(p[i],' '); writeln(p[4]); writeln; end; writeln('type "q" to quit or type "r" to replay'); while (ch<>'q')and(ch<>'r') do readln(ch); until ch<>'r'; end.
2008年12月20日 02点12分
12
level 0
goto语句的一种严重破坏程序结构的语句
goto语句只有刚入门的新手才会使用的
2009年01月19日 13点01分
15
level 0
如果你在看代码时看到有goto语句,这个代码你就没有必要再看下去了
2009年01月20日 00点01分
16
level 5
使用回跳的GOTO语句,会使程序结构难于理解....但不过还好~这个程序还不至于..好久都不用goto了...
2009年01月26日 05点01分
17
level 1
怎么玩怎么玩怎么玩怎么玩怎么玩怎么玩怎么玩怎么玩怎么玩
2009年03月08日 13点03分
18