ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Why doesn't it work? (Pascal)
Posted by Igor 15 Mar 2009 18:26
type
TStack=class(TObject)
public
Data:Extended;
Next:TStack;
function Add(AData:Extended):TStack;
function Delete:TStack;
end;
function TStack.Add(AData:Extended):TStack;
begin
Result:=TStack.Create;
Result.Data:=AData;
Result.Next:=Self
end;
function TStack.Delete:TStack;
begin
Result:=Next;
Free;
end;
var Stack:TStack;
AData:Extended;
begin
Stack:=nil;
while not eof do
begin
Read(AData);
Stack:=Stack.Add(AData)
end;
while Stack<>nil do
begin
Writeln(Sqrt(Stack.Data));
Stack:=Stack.Delete
end;
end.
Re: Why doesn't it work? (Pascal)
Posted by Megov 15 Mar 2009 23:28
while not seekeof do
Re: Why doesn't it work? (Pascal)
Posted by Igor 17 Mar 2009 14:34


Edited by author 17.03.2009 14:43