While working on pascal coding then there may be a situation to add library function o the code then
uses
is the keyword will be used that will call procedures, system functions. The following are the various CRT functions.
- GotoXy(_,_);
- Clrscr;
- Textbackground();
- Readkey;
- Textcolor();
- Halt; / Halt()
- Delay();
The
Clrscr
is used to clear the screen. The following is an example.
[c]Writeln('When you press enter, the screen would be cleared!');
Readln;
ClrScr;[/c]
The GotoXy(_,_) function will move the cursor point to the predefined position. The following is an example.
[c]GotoXY(100,100);
Writeln('The position is 10 pixels from the left of the screen, and ten pixels');
Writeln('from the top of the screen.');
Readln;[/c]
The
Textbackground()
is used to set the background color. The following is an example.
[c]Textbackground(red); {word - red}
Writeln('Note the difference');
Textbackground(5); {integer - 5}
ClrScr;
Writeln('Note the difference');
Readln;[/c]
The
Readkey
function is used to read the key. The following is an example.
[c]Writeln('Press ANY key');
Keypress := Readkey; {keypress is a DECLARED string variable(can be an integer variable)}
Writeln(Keypress);[/c]
The
Textcolor()
is used to give the color for the test. The following is an example.
[c]Textcolor(red); {word - red}
Writeln('Text colour');
Textcolor(5); {integer - 5}
Writeln('Text colour'); Readln;[/c]
The
Delay()
is used to wait for some time. The following is an example.
[c]Writeln('1');
Delay(1000); {1000 milliseconds}
Writeln('2');
Delay(1000);
Writeln('3');
Readln;[/c]
The
Halt()
is used to destroy the code. The following is an example.
[c]Writeln('Press enter and the program terminates!);
Readln;
Halt(0); [/c]