Explorar el Código

Out.Real test module update

Arthur Yefimov hace 3 años
padre
commit
2541fa95be
Se han modificado 1 ficheros con 30 adiciones y 11 borrados
  1. 30 11
      Programs/r.Mod

+ 30 - 11
Programs/r.Mod

@@ -3,19 +3,37 @@ IMPORT In, Out;
 VAR a, b, c: INTEGER;
   x, y: REAL;
   s: ARRAY 10 OF CHAR;
-  i: INTEGER;
+  i, j: INTEGER;
+
+PROCEDURE R(x: REAL; n: INTEGER);
+BEGIN
+  Out.String(' Out.Real(x, ');
+  Out.Int(n, 0); Out.String(') = "');
+  Out.Real(x, n); Out.Char('"'); Out.Ln
+END R;
+
+PROCEDURE RF(x: REAL; n, k: INTEGER);
+BEGIN
+  Out.String(' Out.RealFix(x, ');
+  Out.Int(n, 0); Out.String(', '); Out.Int(k, 0);
+  Out.String(') = "'); Out.RealFix(x, n, k); Out.Char('"'); Out.Ln
+END RF;
+
 BEGIN
-  s := 'Привет!';
-  s[2] := 'ы';
-  Out.String(s);
-  Out.Char('Ж');
-  Out.Ln;
+  Out.String('Please enter a real number: '); In.Real(x);
+  FOR i := 0 TO 15 DO
+    R(x, i)
+  END
+  (*
+  FOR i := 0 TO 15 BY 5 DO
+    FOR j := 0 TO 3 DO
+      RF(x, i, j)
+    END;
+    RF(x, i, 6)
+  END
+  *)
 
-  Out.String('Please enter a real number.'); Out.Ln;
-  Out.String('x='); In.Real(x);
-  Out.String(' REAL1 ['); Out.RealFix(x, 8, 3); Out.String(']'); Out.Ln;
-  Out.String(' REAL2 ['); Out.Real(x, 8); Out.String(']'); Out.Ln;
-  Out.String('AS INT ['); Out.Int(FLOOR(x + 0.5), 8); Out.String(']'); Out.Ln;
+  (*
   Out.String('Enter string:'); In.Line(s);
   Out.String('{'); Out.String(s); Out.String('}'); Out.Ln;
   i := 0;
@@ -23,4 +41,5 @@ BEGIN
     Out.Int(ORD(s[i]), 5); INC(i)
   END; Out.Ln;
   Out.String('Bye!'); Out.Ln
+  *)
 END r.