hamid_200611 مهمون يكي دو روزه
Joined: 06 Dec 2006 Posts: 2
|
Posted: Wed Dec 06, 2006 10:39 am Post subject: |
|
|
program one;
uses crt;
type
student=record
name:string[10];
lastname:string[15];
id:integer;
address:string;
end;
arstudent=array[1..2] of student;
var
s:arstudent;
j:integer;
procedure drowbox;
var
intcol:integer;
begin
clrscr;
gotoxy(5,3);
write(#218);
for intcol:=1 to 70 do
write(#196);
gotoxy(75,3);
write(#191);
gotoxy(75,4);
write(#179);
gotoxy(75,5);
write(#179);
gotoxy(69,3);
write(#194);
gotoxy(69,4);
write(#179);
gotoxy(69,5);
write(#179);
gotoxy(5,4);
write(#179);
gotoxy(5,5);
write(#179);
gotoxy(55,3);
write(#194);
gotoxy(55,4);
write(#179);
gotoxy(55,5);
write(#179);
gotoxy(37,3);
write(#194);
gotoxy(37,4);
write(#179);
gotoxy(37,5);
write(#179);
gotoxy(18,3);
write(#194);
gotoxy(18,4);
write(#179);
gotoxy(18,5);
write(#179);
gotoxy(5,6);
write(#192);
for intcol:=1 to 69 do
write(#196);
gotoxy(75,6);
write(#217);
for intcol:=7 to 25 do
begin
gotoxy(5,intcol);
write(#179);
gotoxy(75,intcol);
write(#179);
gotoxy(18,intcol);
write(#179);
gotoxy(37,intcol);
write(#179);
gotoxy(69,intcol);
write(#179);
gotoxy(55,intcol);
write(#179);
end
end;
كه خروجي اين رويه شكل زير است.
رويه دوم مربوط به علائم روي جدول است.
procedure rite;
var
k:integer;
begin
gotoxy(71,4);
write('num');
gotoxy(63,4);
write('name ');
gotoxy(40,4);
write('last name ');
gotoxy(22,4);
write('id ');
gotoxy(7,4);
write('address');
for k:=7 to 25 do
begin
gotoxy(72,k);
write(k-6);
end
end;
و باعث مي شود خروجي به صورت زير باشد.
رويه سوم مربوط به مرتب سازي با نام sort مي باشد.
procedure sort(var list:arstudent);
var
intpos,intfpos,intmin:integer;
rec:student;
begin
for intfpos :=low(list) to high(list) do
begin
intmin:=intfpos;
for intpos :=intfpos+1 to high(list) do
if (list[intmin].lastname>list[intpos].lastname) or
((list [intmin].lastname=list[intpos].lastname) and
(list[intmin].name>list[intpos].name)) then
intmin:=intpos;
rec:=list[intmin];
list[intmin]:=list[intfpos];
list[intfpos]:=rec;
end
end;
procedure sort(var list:arstudent);
var
intpos,intfpos,intmin:integer;
rec:student;
begin
for intfpos :=low(list) to high(list) do
begin
intmin:=intfpos;
for intpos :=intfpos+1 to high(list) do
if (list[intmin].lastname>list[intpos].lastname) or
((list [intmin].lastname=list[intpos].lastname) and
(list[intmin].name>list[intpos].name)) then
intmin:=intpos;
rec:=list[intmin];
list[intmin]:=list[intfpos];
list[intfpos]:=rec;
end
end;
procedure sort(var list:arstudent);
var
intpos,intfpos,intmin:integer;
rec:student;
begin
for intfpos :=low(list) to high(list) do
begin
intmin:=intfpos;
for intpos :=intfpos+1 to high(list) do
if (list[intmin].lastname>list[intpos].lastname) or
((list [intmin].lastname=list[intpos].lastname) and
(list[intmin].name>list[intpos].name)) then
intmin:=intpos;
rec:=list[intmin];
list[intmin]:=list[intfpos];
list[intfpos]:=rec;
end
end; |
|