⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ans_159a.pro

📁 prolog,人工智能推理程序,运行环境prolog
💻 PRO
字号:
/*
   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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -