{ ตัวอย่างการกำหนดสีพื้น และสีตัวอักษร }
uses crt;
var i:integer;
begin
clrscr;
writeln(blink); { 128 }
textcolor(blue + blink); (* for full screen *)
for i:=0 to 31 do
begin
textbackground(i + blink);
write(i);
end;
writeln; textcolor(yellow);
for i:=0 to 7 do { text blink }
begin
textbackground(i mod 2);
gotoxy(1,3); write(i);
delay(500); { 1000 = 1 second }
end;
readln;
end.
| |
{ ตัวอย่าง procedure } #
program p01;
procedure GetName;
var
Name: String;
begin
Writeln('What is your name?');
Readln(Name);
if Name = '' then
Exit;
Writeln('Your name is ',Name);
end;
begin
GetName;
end.
{ ตัวอย่าง function }
program Functions;
var
Answer: Integer;
function Add(i,j:Integer):Integer;
begin
Add := i + j;
end;
begin
Answer := Add(1,2);
Writeln(Add(1,2));
end.
|