Subversion Repositories Kolibri OS

Rev

Rev 8859 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ´╗┐MODULE HW_con;
  2.  
  3. IMPORT Out, In, Console, DateTime;
  4.  
  5.  
  6. PROCEDURE OutInt2(n: INTEGER);
  7. BEGIN
  8.     ASSERT((0 <= n) & (n <= 99));
  9.     IF n < 10 THEN
  10.         Out.Char("0")
  11.     END;
  12.     Out.Int(n, 0)
  13. END OutInt2;
  14.  
  15.  
  16. PROCEDURE OutMonth(n: INTEGER);
  17. VAR
  18.     str: ARRAY 4 OF CHAR;
  19.  
  20. BEGIN
  21.  
  22.     CASE n OF
  23.     | 1: str := "jan"
  24.     | 2: str := "feb"
  25.     | 3: str := "mar"
  26.     | 4: str := "apr"
  27.     | 5: str := "may"
  28.     | 6: str := "jun"
  29.     | 7: str := "jul"
  30.     | 8: str := "aug"
  31.     | 9: str := "sep"
  32.     |10: str := "oct"
  33.     |11: str := "nov"
  34.     |12: str := "dec"
  35.     END;
  36.  
  37.     Out.String(str)
  38. END OutMonth;
  39.  
  40.  
  41. PROCEDURE main;
  42. VAR
  43.     Year, Month, Day, Hour, Min, Sec, Msec: INTEGER;
  44.  
  45. BEGIN
  46.     Out.String("Hello, world!"); Out.Ln;
  47.     Console.SetColor(Console.White, Console.Red);
  48.     DateTime.Now(Year, Month, Day, Hour, Min, Sec, Msec);
  49.     Out.Int(Year, 0); Out.Char("-");
  50.     OutMonth(Month);  Out.Char("-");
  51.     OutInt2(Day);     Out.Char(" ");
  52.     OutInt2(Hour);    Out.Char(":");
  53.     OutInt2(Min);     Out.Char(":");
  54.     OutInt2(Sec)
  55. END main;
  56.  
  57.  
  58. BEGIN
  59.     Console.open;
  60.     main;
  61.     In.Ln;
  62.     Console.exit(TRUE)
  63. END HW_con.