Hi!
j y wrote 9 lines
please help. i need the code in below translated to
borland pascal:
let's say: num1min :=10 num1max :=20 num2min :=10
num2ref :=100
Repeat
(* some stuff go here *)
num1[a] := num1min + num1incr.
num2[a] := num2min + num2incr.
Until num2 > num2ref
I don't know what language you are thinking your source is but none of the ones I know would ever fulfill the until condition. Or are you referring to C where you write here "+=" as ":="?
Show quoted text 7 lines
Then like to print the results after the test is
stopped to screen/file:
If num1 <= num1min then print "val <= actual value of
num1min"
If num1min < num1 < num1max then print "val = actual
value of num1"
If num1 >= num1max then print "val >= actual value of num1max".
But you have almost written your code. The following is your code a bit reordered and corrected to be able to exit:
PROGRAM bogus;
CONST
num1min=10;
num1max=20;
num2min=10;
num2ref=100;
VAR
num1,num2:LongInt;
BEGIN
Repeat
(* some stuff go here *)
num1 := num1 + num1min + num1incr;
num2 := num2 + num2min + num2incr;
Until num2 > num2ref;
If num1 <= num1min then WriteLn("val <= actual value of num1min");
If (num1min < num1) AND (num1 < num1max) then
WriteLn("val = actual value of num1");
If num1 >= num1max then WriteLn("val >= actual value of num1max");
END.
By the way, instead of iterating these expressions this could easily be calculated using a formula involving nothing more than multiplication.
Did this help?