I am currently learning Pascal at school an I'm thought i was getting pretty efficient until i was set work on the repeat until loop. I was working on a program that squares then cubes a number until a rouge value of -9999.99 but it won't!
(* Author: Tony Diec
Date: Tuesday, 23rd September 2008
Description: Squares And Cubes Numbers.
*)
program SquareCube;
var
Num1, Square, Cube : real;
procedure Obtain;
begin
Square := Num1 * Num1;
writeln (Num1,' Squared = ',Square);
Cube := Square * Num1;
writeln (Num1,' Cubed = ',Cube);
writeln ('Input The Number You Would Like To Square And Cube');
writeln ('WARNING! Entering -9999.99 Will End Program');
readln (Num1);
end;
procedure ObtainNum;
begin
writeln ('Input The Number You Would Like To Square And Cube');
writeln ('WARNING! Entering -9999.99 Will End Program');
readln (Num1);
repeat
Obtain
until Num1 = -9999.99;
end;
begin
ObtainNum;
readln;
end.