Back to exercises index

Program skeleton

Just copy the skeleton and start programming...

Complete Skeleton


Topics: A

MODULE ModuleName;
<* WOFF + *>        (* No Warnings *)
<* NOOPTIMIZE + *>  (* For the Debugger *)

    FROM IO IMPORT WrStr, WrLn, RdCard, WrCard, RdInt, WrInt;     (* import general procedures *)

    VAR ...;            (* variable-declarations *)

BEGIN
    WrLn;

        ...

END ModuleName.


Topics: B

MODULE ModuleName;
<* WOFF + *>        (* No Warnings *)
<* NOOPTIMIZE + *>  (* For the Debugger *)

    FROM IO IMPORT WrStr, WrLn, RdCard, WrCard, RdInt, WrInt;     (* import general procedures *)

    CONST  = ;          (* constants *)

    VAR ...;            (* variable-declarations *)

BEGIN
    WrLn;
        ...
END ModuleName.


Topics: B with graphics

MODULE ModuleName;
<* WOFF + *> <* NOOPTIMIZE + *>
  FROM IO IMPORT WrStr, WrLn, RdCard, WrCard, RdInt, WrInt, RdKey, RdLn;
  FROM Lib IMPORT Delay; (* Delay: let the program wait a little time *)
      (* de wimdows library vind je onder parallel.vub.ac.be > Education > Modula-2 > Technology *)
  FROM Wimdows IMPORT Window, KillWindow, Text, SetFont, GetKey, Rectangle, Circle, Line, Disc;
  FROM Wimdows IMPORT _clrBLACK, _clrBLUE, _clrGREEN, _clrCYAN, _clrRED, _clrMAGENTA;
  FROM Wimdows IMPORT _clrBROWN, _clrWHITE, _clrGRAY, _clrLIGHTBLUE, _clrLIGHTGREEN;
  FROM Wimdows IMPORT _clrLIGHTCYAN, _clrLIGHTRED, _clrLIGHTMAGENTA, _clrLIGHTYELLOW, _clrBRIGHTWHITE;
                
  VAR
   x:CARDINAL;
BEGIN

  (* Initialise graphics *)
  Window("titel", 500, 500);


     
 

  (* tell user to press a key to finish the program... *)
  SetFont(1, _clrRED);
  Text("press any key to finish the program", 135, 10);

  (* ...and program will wait here until user presses a key *)
  x := GetKey();

  (* finally close the window *)
  KillWindow();

END ModuleName.


Topics: C,D

MODULE ModuleName;
<* WOFF + *> <* NOOPTIMIZE + *>
    FROM IO IMPORT RdChar, WrChar, WrStr, RdStr, WrLn, RdCard, WrCard, RdInt, WrInt, RdReal, WrReal, RdLn;     (* import general procedures *)

    CONST              (* constants *)

    VAR               (* variable-declarations *)

BEGIN
    WrLn;
 

END ModuleName.


Topics: C,D with graphics

MODULE ModuleName;
<* WOFF + *> <* NOOPTIMIZE + *>
  FROM IO IMPORT RdChar, WrChar, WrStr, RdStr, WrLn, RdKey, RdLn, RdCard, WrCard, RdInt, WrInt, RdReal, WrReal;
  FROM Lib IMPORT Delay; (* Delay: let the program wait a little time *)
     
(* de wimdows library vind je onder parallel.vub.ac.be > Education > Modula-2 > Technology *)
  FROM Wimdows IMPORT Window, KillWindow, GetKey, SetFont, Text, Rectangle, Circle, Disc, Line, Polygon;
  FROM Wimdows IMPORT _clrBLACK, _clrBLUE, _clrGREEN, _clrCYAN, _clrRED, _clrMAGENTA;
  FROM Wimdows IMPORT _clrBROWN, _clrWHITE, _clrGRAY, _clrLIGHTBLUE, _clrLIGHTGREEN;
  FROM Wimdows IMPORT _clrLIGHTCYAN, _clrLIGHTRED, _clrLIGHTMAGENTA, _clrLIGHTYELLOW, _clrBRIGHTWHITE;
                
  CONST SCREEN_SIZE = 600;     (* constants *)
  VAR
   x:CARDINAL;
BEGIN
  (* Initialise graphics *)
  Window("titel", SCREEN_SIZE, SCREEN_SIZE);
  
 



  (* tell user to press a key to finish the program... *)
  SetFont(1, _clrRED);
  Text("press any key to finish the program", SCREEN_SIZE/2-120, 10);
  (* ...and program will wait here until user presses a key *)
  x := GetKey();
  (* finally close the window *)
  KillWindow();


END ModuleName.



 

Topics: E, G

MODULE ModuleName;
<* WOFF + *> <* NOOPTIMIZE + *>
    FROM IO IMPORT RdChar, WrChar, WrStr, RdStr, WrLn, RdCard, WrCard, RdInt, WrInt, RdReal, WrReal, WrFixReal, RdBool, WrBool, RdLn;  (* import general procedures *)
    FROM RealMath IMPORT sqrt, exp, sin, cos, tan, arcsin, arccos, arctan, power, round, pi;
    FROM Lib IMPORT Delay; (* Wait n milliseconds *)

    CONST             (* constants *)

    VAR              (* variable-declarations *)

BEGIN
    WrLn;
 

END ModuleName.


Topics: F  until N

MODULE M;
<* WOFF + *> <* NOOPTIMIZE + *>
    FROM IO IMPORT RdChar, WrChar, WrStr, RdStr, WrLn, RdLn, RdCard, WrCard, RdInt, WrInt, RdReal, WrReal, WrFixReal, RdBool, WrBool;
    FROM RealMath IMPORT sqrt, exp, sin, cos, tan, arcsin, arccos, arctan, power, round, pi;

    CONST              (* constants *)

    TYPE

(*    PROCEDURE ( : ; : ): ;
      VAR result: ;
    BEGIN
      RETURN result;
    END ;*)

    VAR               (* variable-declarations *)

BEGIN
    WrLn;
 

END M.


Topics: F  until N with graphics

MODULE M;
<* WOFF + *> <* NOOPTIMIZE + *>
   FROM IO IMPORT RdChar, WrChar, WrStr, RdStr, WrLn, RdLn, RdCard, WrCard, RdInt, WrInt, RdReal, WrReal, WrFixReal, RdBool, WrBool, RdKey, KeyPressed;
    FROM RealMath IMPORT sqrt, exp, sin, cos, tan, arcsin, arccos, arctan, power, round, pi;
    FROM Lib IMPORT Delay; (* Wait n milliseconds *)
    FROM Wimdows IMPORT Window, KillWindow, GetKey, SetFont, Text, Line, Rectangle, Circle, Disc, Polygon, _clrBLACK, _clrBLUE, _clrGREEN, _clrCYAN, _clrRED, _clrMAGENTA;
    FROM Wimdows IMPORT _clrBROWN, _clrWHITE, _clrGRAY, _clrLIGHTBLUE, _clrLIGHTGREEN, _clrLIGHTCYAN, _clrLIGHTRED, _clrLIGHTMAGENTA, _clrLIGHTYELLOW, _clrBRIGHTWHITE;
         

    CONST SCREEN_SIZE = 600;   (* constants *)

     VAR x: CARDINAL;          (* variable-declarations *)

BEGIN
    WrLn;
    Window("titel", SCREEN_SIZE, SCREEN_SIZE);
 

 



  (* tell user to press a key to finish the program... *)
  SetFont(1, _clrRED);
  Text("press any key to finish the program", SCREEN_SIZE/2-120, 10);
  (* ...and program will wait here until user presses a key *)
  x := GetKey();
  (* finally close the window *)
  KillWindow();

END M.


Topics: O & further

MODULE M;
<* M2EXTENSIONS + *> <* STORAGE + *> <* WOFF + *> <* NOOPTIMIZE + *>
    FROM IO IMPORT RdChar, WrChar, WrStr, RdStr, WrLn, RdCard, WrCard, RdInt, WrInt, RdReal, WrReal, WrFixReal, RdBool, WrBool;
    FROM RealMath IMPORT sqrt, exp, sin, cos, tan, arcsin, arccos, arctan, power, round, pi;

    CONST              (* constants *)

    TYPE

(*    PROCEDURE ( : ; : ): ;
      VAR toReturn: ;
    BEGIN
      RETURN toReturn;
    END ;*)

    VAR               (* variable-declarations *)

BEGIN
    WrLn;
 

END M.


Back to the top -- Back to exercises index