I changed the code a little by putting real instead of longit...
program ShoeInventoryRecords;
type
Shoes = record
tag: packed array [1..50] of char;
brand: packed array [1..50] of char;
category: packed array [1..50] of char;
material: packed array [1..50] of char;
classification: packed array [1..50] of char;
colour: packed array [1..50] of char;
size: longint;
price: real;
end;
var
shoe1, shoe2,shoe3, shoe4: Shoes; (* Declare shoe1 and shoe2 of type Shoes *)
(* procedure declaration *)
procedure printshoe( var shoe: Shoes );
begin
(* print shoe info *)
writeln ('shoe tag : ', shoe.tag);
writeln('shoe brand : ', shoe.brand);
writeln( 'shoe category : ', shoe.category);
writeln( 'shoe material : ', shoe.material);
writeln( 'shoe classification : ', shoe.classification);
writeln( 'shoe colour : ', shoe.colour);
writeln( 'shoe size : ', shoe.size);
writeln( 'shoe price : ', shoe.price);
end;
begin
(* shoe 1 specification *)
shoe1.tag := 'Jordan One';
shoe1.brand := 'Nike ';
shoe1.category := 'Basketball';
shoe1.material := 'leather';
shoe1.classification := 'light';
shoe1.colour := 'Red';
shoe1.size := 8;
shoe1.price := 110;
(* shoe 2 specification *)
shoe2.tag := 'Superstar';
shoe2.brand := 'Adidas';
shoe2.category := 'Casual';
shoe2.material := 'leather';
shoe2.classification := 'light';
shoe2.colour := 'white';
shoe2.size := 7;
shoe2.price := 75;
(* shoe 3 specification *)
shoe3.tag := 'LeBron Soldiers';
shoe3.brand := 'Nike';
shoe3.category := 'Basketball';
shoe3.material := 'Leather and cotton';
shoe3.classification := 'light';
shoe3.colour := 'white';
shoe3.size := 11;
shoe3.price := 140;
(* shoe 4 specification *)
shoe4.tag := 'Superstar';
shoe4.brand := 'Adidas';
shoe4.category := 'Casual';
shoe4.material := 'leather';
shoe4.classification := 'light';
shoe4.colour := 'white';
shoe4.size := 7;
shoe4.price := 75;
(* print shoe1 info *)
printshoe(shoe1);
writeln;
(* print shoe2 info *)
printshoe(shoe2);
writeln;
printshoe(shoe3);
writeln;
printshoe(shoe4);
writeln;
readln;
end.
----------------------------------------------------------------------------------------------------------------------------------------------------
this is the outcome, i cant remember how to only get 2 or 3 decimal places only.
shoe tag : Jordan One
shoe brand : Nike
shoe category : Basketball
shoe material : leather
shoe classification : light
shoe colour : Red
shoe size : 8
shoe price : 1.100000000000000E+002
shoe tag : Superstar
shoe brand : Adidas
shoe category : Casual
shoe material : leather
shoe classification : light
shoe colour : white
shoe size : 7
shoe price : 7.500000000000000E+001
shoe tag : LeBron Soldiers
shoe brand : Nike
shoe category : Basketball
shoe material : Leather and cotton
shoe classification : light
shoe colour : white
shoe size : 11
shoe price : 1.400000000000000E+002
shoe tag : Superstar
shoe brand : Adidas
shoe category : Casual
shoe material : leather
shoe classification : light
shoe colour : white
shoe size : 7
shoe price : 7.500000000000000E+001
----------------------------------------------------------------------------------------------------------------------------------------------------
btw, this would be the sorting algorithm from another code i had written previously, i wanted to somehow implement it into the code. Unfortunately don't know-how.
program sort1;
var
sort:array[1..5] of integer;
i,y,x,irand1,irand2,irand3,irand4,irand5,temp:integer;
begin
randomize;
irand1:= random(10);
irand2:= random(10);
irand3:= random(10);
irand4:= random(10);
irand5:= random(10);
sort[1]:=irand1;
sort[2]:=irand2;
sort[3]:=irand3;
sort[4]:=irand4;
sort[5]:=irand5;
for x:= 1 to 5 do
begin
write (sort
end;
writeln;
for i:=1 to 5 do
begin
for y:= 1 to 4 do
begin
if sort[y]>sort[y+1] then
begin
temp:=sort[y];
sort[y]:=sort[y+1];
sort[y+1]:=temp;
end;
end;
for x:= 1 to 5 do
begin
write (sort
end;
writeln;
end;
readln;
end.
---------------------------------------------------------------------------------------------------------------------------------------------------