8/02/2006
Pascal tutorial 5
.: Library
Library is used to use comands which have been defined by a selected library. Library example : crt, dos, windos, graph, dsb. Try you compare example before with this example :
Program library1;
uses crt;
Var
name:string;
Begin
textcolor(White);
GotoXY(1,10);
write(‘ write your name: ');
readln(name);
writeln(‘my name is ',name);
write(‘keep studying’);
readln;
End.
Above program is using CRT library ( And possibly this library which is often used). Every library defines the function of each. Some commands in library of CRT :
| Statement | Function | Syntax |
| GotoXY | Place cursor anywhere you want. With x coordinate from left screen to right screen, and y coordinate from above to down. CRT have resolution 80 x 25 (amount of x coordinate is 80 and y coordinate is 25). | GotoXY(int,int); Example: GotoXY(1,5); |
| Delay | Stop the program temporally (in milliseconds) | Delay(int); Example: Delay(1000); |
| Textbackground | Give background color of text. | Textbackground(word/int); Example: Textbackground(red); |
| Textcolor | Give text color | Textcolor(word/int); Example: Textcolor(white); |
| Halt | Terminate program | Halt; |
| InsLine | Insert one line | InsLine; |
| DelLine | Delete one line | DelLine; |
| TextMode | Change column in screen, 80 or 40 column | TextMode(C40); default 80 |
| Clrscr | Clear screen | Clrscr; |