You are here:
Foswiki
>
Main Web
>
Program2
(09 Jun 2004,
DorotaP
)
(raw view)
E
dit
A
ttach
''Program sortuje litery alfabetu'' program rekordy; uses crt; type cos=record pole1:integer; pole2:char; end; const maxroz=10; var tab:array[1..1000] of cos; i,j,m,pom,n:integer; pom1:char; begin clrscr; write('podaj rozmiar tablicy'); read(n); randomize; for i:=1 to n do begin tab[i].pole1:=random(1000); tab[i].pole2:=chr(65+random(26)); writeln(tab[i].pole1,' ',tab[i].pole2); end; for i:=2 to n do begin j:=i; while(j>1) and (tab[j-1].pole1>tab[j].pole1) do begin pom:=tab[j].pole1; pom1:=tab[j].pole2; tab[j].pole1:=tab[j-1].pole1; tab[j].pole2:=tab[j-1].pole2; tab[j-1].pole1:=pom; tab[j-1].pole2:=pom1; j:=j-1; end; end; for i:=2 to n do begin j:=i; while(j>1) and (tab[j-1].pole2>tab[j].pole2) do begin pom1:=tab[j].pole2; pom:=tab[j].pole1; tab[j].pole2:=tab[j-1].pole2; tab[j].pole1:=tab[j-1].pole1; tab[j-1].pole2:=pom1; tab[j-1].pole1:=pom; j:=j-1; end; end; writeln('uporzadkowana tablica:'); for i:=1 to n do write(tab[i].pole2,'-',tab[i].pole1,' '); readln; readln; end.
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r2
<
r1
|
B
acklinks
|
V
iew topic
|
Edit
w
iki text
|
M
ore topic actions
Topic revision: r2 - 09 Jun 2004,
DorotaP
Main
Log In
or
Register
Toolbox
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Users
Groups
Webs
Cosmo
Main
Sandbox
System
English
Français
Polski
Copyright © CC-BY-SA by the contributing authors. All material on this collaboration platform is copyrighted under CC-BY-SA by the contributing authors unless otherwise noted.
Ideas, requests, problems regarding Foswiki?
Send feedback