Tutorial Lesson Part II -
V.I.P FORUM :: DESKTOP CORNER :: PROGRAMING :: PASCAL
Halaman 1 dari 1
Tutorial Lesson Part II -
To change the color of the text printed on the screen we use the TextColor command.
program Colors;
uses
crt;
begin
TextColor(Red);
Writeln('Hello');
TextColor(White);
Writeln('world');
end.
The TextBackground command changes the color of the background of text. If you want to change the whole screen to a certain color then you must use ClrScr.
program Colors;
uses
crt;
begin
TextBackground(Red);
Writeln('Hello');
TextColor(White);
ClrScr;
end.
Screen coordinates
You can put the cursor anywhere on the screen using the GoToXY command. In DOS, the screen is 80 characters wide and 25 characters high. The height and width varies on other platforms. You may remember graphs from Maths which have a X and a Y axis. Screen coordinates work in a similar way. Here is an example of how to move the cursor to the 10th column in the 5th row.
program Coordinates;
uses
crt;
begin
GoToXY(10,5);
Writeln('Hello');
end.
Windows
Windows let you define a part of the screen that your output will be confined to. If you create a window and clear the screen it will only clear what is in the window. The Window command has 4 parameters which are the top left coordinates and the bottom right coordinates.
program Coordinates;
uses
crt;
begin
Window(1,1,10,5);
TextBackground(Blue);
ClrScr;
end.
Using window(1,1,80,25) will set the window back to the normal size.
Sound
The Sound command makes a sound at the frequency you give it. It does not stop making a sound until the NoSound command is used. The Delay command pauses a program for the amount of milliseconds you tell it to. Delay is used between Sound and NoSound to make the sound last for a certain amount of time.
program Sounds;
uses
crt;
begin
Sound(1000);
Delay(1000);
NoSound;
end.
program Colors;
uses
crt;
begin
TextColor(Red);
Writeln('Hello');
TextColor(White);
Writeln('world');
end.
The TextBackground command changes the color of the background of text. If you want to change the whole screen to a certain color then you must use ClrScr.
program Colors;
uses
crt;
begin
TextBackground(Red);
Writeln('Hello');
TextColor(White);
ClrScr;
end.
Screen coordinates
You can put the cursor anywhere on the screen using the GoToXY command. In DOS, the screen is 80 characters wide and 25 characters high. The height and width varies on other platforms. You may remember graphs from Maths which have a X and a Y axis. Screen coordinates work in a similar way. Here is an example of how to move the cursor to the 10th column in the 5th row.
program Coordinates;
uses
crt;
begin
GoToXY(10,5);
Writeln('Hello');
end.
Windows
Windows let you define a part of the screen that your output will be confined to. If you create a window and clear the screen it will only clear what is in the window. The Window command has 4 parameters which are the top left coordinates and the bottom right coordinates.
program Coordinates;
uses
crt;
begin
Window(1,1,10,5);
TextBackground(Blue);
ClrScr;
end.
Using window(1,1,80,25) will set the window back to the normal size.
Sound
The Sound command makes a sound at the frequency you give it. It does not stop making a sound until the NoSound command is used. The Delay command pauses a program for the amount of milliseconds you tell it to. Delay is used between Sound and NoSound to make the sound last for a certain amount of time.
program Sounds;
uses
crt;
begin
Sound(1000);
Delay(1000);
NoSound;
end.
Similar topics
» Decisions Part I
» ASP.NET (tutorial)
» Tutorial Shaping
» netcut Tutorial
» Module SWISH MAX Tutorial
» ASP.NET (tutorial)
» Tutorial Shaping
» netcut Tutorial
» Module SWISH MAX Tutorial
V.I.P FORUM :: DESKTOP CORNER :: PROGRAMING :: PASCAL
Halaman 1 dari 1
Permissions in this forum:
Anda tidak dapat menjawab topik