Sometimes people want to present their programs in a more entertaining way.
A D V E R T I S E M E N T
There are some things in the Crt unit that can spice up your program and
make it neater. Remember to use the Crt unit in your programs you put uses
Crt; at the start of your program.
Colouring your text makes the program more
attractive and pleasing to the eye. You will also be able to put borders around
your text, and make headings clearer.
The way that that this works is shown below...
Where int is an integer between 0 and 16. Pretty simple really. Here is a list
of the different colors represented by int.
0 - Black
1 - Dark Blue
2 - Dark Green
3 - Dark Cyan
4 - Dark Red
5 - Purple
6 - Brown
7 - Light Grey
8 - Dark Grey
9 - Light Blue
10 - Light Green
11 - Cyan
12 - Light Red
13 - Pink
14 - Yellow
15 - White
A text effect that you might want to have in your program might be highlighting
behind the text. This is done with a nifty little procedure called
textBackground. Remember though, that when you use this to change the text
background colour and clear the screen, it will clear it using that background
colour. eg If you change it to blue and clear the screen, the whole screen will
be blue. So when you clear the screen be sure to change the background color
back to black (unless you want the screen to go blue)!
int is a number between 0 and 7.
Another thing that you might want to do with your program is have a menu at the
center of the screen. This means that a procedure to move the cursor to a
certain point on the screen would be quite useful. Well fortunately there is
such a procedure. This procedure is known as gotoXY.
A common text screen has width 80 and height 25, so make sure you don't place
the cursor off the screen. Doing this may yield unpredictable results. After you
have moved the cursor to a place the next write or writeln instruction will
start from there. If you do a writeln the cursor will move down a line but will
not relocate itself to the same x co-ordinate as the last gotoXY.