A real (Turbo)-Pascal Program

This program cleans the screen, and outputs a prompt "Input string -->" inviting a user to enter a series of characters from the keyboard. This prompt will be output in the 10th line from above and starting with 15th column by using yellow letters on the blue background. So, one will get the following output on the screen:




     Input string -->                 





As the user enters a string of characters terminated by hitting the Return key, this string will be displayed in the 20th row startiung with 15th screen column.

For example, if the user would enter "Hello World!", the program provides the following output:




     Input string --> Hello Woirld!    


   
     Hello World!


This program can be compiled by using Borland Turbo-Pascal system. The comments are put between (* and *) tags according to the conventions of the Turbo-Pascal system.

program test;                   (* name of the program *)
USES CRT;                       (* special library responsible for screen output *)

var s : string;                 (* declaration of a variable of type "string" *)

begin                           (* the code starts here *)
  TextColor(yellow);            (* set the yellow foreground color *)
  TextBackground(blue);         (* set the blue background color *)
  ClrScr;                       (* clean the screen *)

  GotoXY(15,10);                (* put the screen cursor to the 10th row and 15th column *)
  write('Input string -->');    (* output a prompt to the screen *)
  readln(s);                    (* read user's input from the keyboard *)

  GotoXY(15,20);                (* put the screen cursor to the 20th row and 15th column *)
  writeln(s);                   (* output the user's input *)

end.                            (* end of code *)

As you can see most of these high-level language instructions are quite understandable even without a special knowledge of Pascal. You can compare this program with its assembly language analog. Both programs have the same functionality. Evidently the machine language is much more complicated and the same program is much longer. The computer, however, needs a binary encoding of all the machine instructions of this longer program. Therefore, a process of getting the execubable (binary) file is usualy going like this:

Program on a high-level language ->(compiler)-> Program on a machine language ->(linker)-> binary (executable) file

Compiler and Linker are special pieces of software here that significantly simplify the software design.