ans_159a.pro

来自「prolog,人工智能推理程序,运行环境prolog」· PRO 代码 · 共 33 行

PRO
33
字号
/*
   Turbo Prolog 2.0, Answer to first Exercise on page 159.
   
   Copyright (c) 1986, 88 by Borland International, Inc
*/
   
/* 
 *   Uses repeat to keep accepting characters, printing 
 *   them all in upper case until the user presses Enter. 
 */

Predicates
   nondeterm repeat
   typewriter

Clauses
   repeat.
   repeat :- repeat.

   typewriter :- repeat,
                 readchar(C),        /* Read a char and bind it C */
                 upper_lower(C1,C) , /* Convert C to upper case   */
                 write(C1),
                 char_int(C,13).     /* Is C = ASCII 13? 
                                        This call will fail until a <CR> is
                                        hit.  When the user presses <CR>,
                                        the loop will finally succeed,
                                        ending the repeat/fail process.
                                     */
Goal
   makewindow(1,2,3," Typewriter ",0,0,25,80) ,
   typewriter.
   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?