Wed, 18 Jun 1902 08:00:00 GMT
Need HELP FINISHING PROGRAM (posted program) PASCAL
Can someone please help me finish this program. I need it to sort the numbers instead of printing them in random order. If you can help me E-MAIL me at SUPER...@aol.com Thanks Program ch14 (input, output); {Produces a list of 1000 numbers without duplicates and lists them in order} uses crt, printer; label 10; var pnum, a, b, x, y, z: integer; num: array [1..1000] of integer; order: array [1..2000] of integer; outfile: file of integer; procedure sort; begin for x := 1 to 999 do for y:=x+ 1 to 1000 do if num [x] >num[y] then; begin z := num[x]; num[x] := num[y]; num[y] := z; end; end; begin clrscr; assign (outfile, 'c:c14.txt'); rewrite (outfile); randomize; for a:=1 to 2000 do order [a] := 0; for x:= 1 to 1000 do begin 10:pnum:=random(2000) + 1; if order [pnum] = 0 then num [x] := pnum else goto 10; order[pnum] := 1; end; sort; for b:= 1 to 1000 do write (outfile, num [z]); for b:= 1 to 1000 do if b mod 10=0 then writeln (lst, num[b]:8)else writeln(lst, num[b]:8); end.
|