home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l217 / 2.ddi / EXAMPLES / CH12EX05.PRO < prev    next >
Encoding:
Text File  |  1990-03-26  |  1.0 KB  |  26 lines

  1. /*
  2.    Copyright (c) 1986, 90 by Prolog Development Center
  3. */
  4.    
  5.    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  6.     * writef is similar to formatted-print statements in other    *
  7.     * programming languages. writef accepts an output string      *
  8.     * and a set of bound variables and constants as its arguments *
  9.     *                                                *
  10.     *          writef(FormatString, Arg1, Arg2,...)          *
  11.     *                                              *
  12.     * The arguments are inserted into the output string at the    *
  13.     * locations of the format specifiers.              *
  14.     *                                  *
  15.     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  16.     
  17. goal
  18.    A = one,
  19.    B = 330.12,
  20.    C = 4.3333375,
  21.    D = "one two three",
  22.    writef("A = '%-7' \nB = '%8.1e'\n",A,B),
  23.    writef("A = '%' \nB = '%8.4e'\n",A,B),nl,
  24.    writef("C = '%-7.7g' \nD = '%7.7e'\n",C,D),
  25.    writef("C = '%-7.0f' \nD = '%0'\n",C,D),
  26.    writef("char: %c, decimal: %d, hex: %x, unsigned: %u", 97,'a',33,-1).