TPK algorithm: Difference between revisions

Content deleted Content added
Implementations: provided Java 5 implementation that uses List collection
Pascal: The ISO 7185 standard requires constant, variable, and function declarations to follow in this order, and program parameters to be present if I/O procedures are used on them. Also, fix a few useless semicolons.
Line 190:
===[[Pascal_(programming_language)| Pascal]]===
<source lang="pascal">
program TrabbPardoKnuth(input, output);
 
function F(X : real) : real;
begin
F := Sqrt(Abs(X)) + 5 * X * X * X;
end;
 
const
Line 201 ⟶ 196:
 
var
Vals : array[1..N] of real;
I, X : integer;
 
function F(X : real) : real;
begin
F := Sqrt(Abs(X)) + 5 * X * X * X;
end;
 
begin
for I := 1 Toto N do
ReadLn(Vals[I]);
 
Line 211:
begin
X := F(Vals[I]);
if X > 400 Thenthen
WriteLn('Too Largelarge!')
else
WriteLn(X);
end;
end.
</source>