uses crt; type str79=string[79]; var s,s2,ban1,ban2:string; stop:boolean; n,i:integer; Procedure heart; begin textcolor(lightred); Writeln(' ** ** * * * '); writeln(' * * * * * * * '); Writeln(' * * * * * '); writeln(' * * * '); writeln(' * * * '); writeln(' * * * '); writeln(' * * * '); writeln(' * * * * '); writeln(' * * * * '); writeln(' * * * * '); writeln(' * * '); end; Procedure load(t:integer); var i:integer; begin Write('Loading'); for i:=1 to 3 do begin write('.'); delay(t*100); end; write('100% Done!'); clrscr; end; Procedure Cangiua(var s:str79); var i,n:integer; begin n:=length(s); n:=(80-n) div 2; for i:=1 to n do s:='//'+s; end; Procedure chu_chay(s:str79; var s2:str79); var i,n:integer; begin s2:=copy(s,2,length(s)-1)+s[1]; end; Procedure chucmung(x,y:integer); begin Gotoxy(x,y); Writeln('_/_\_'); gotoxy(x,y+1);Write ('_/_\_'); delay(300); Gotoxy(x+4,y); write('_/_\_'); Gotoxy(x+4,y+1); write('_/_\_'); end; begin clrscr; Write('Nhap ten ban: '); Readln(ban1); Write('Nhap ten nguoi ay: '); Readln(ban2); Ban1[1]:=upcase(ban1[1]); Ban2[1]:=upcase(ban2[1]); S:=ban1+' want to say: I Love You '+ban2 load(5); clrscr; cangiua(s); stop:=false; i:=1; textcolor(lightgreen); While i<=20 do begin delay(300); gotoxy(1,1); chu_chay(s,s2); s:=s2; write(s); i:=i+1; writeln; end; heart; i:=1; s:='3'; gotoxy(7,5); textcolor(yellow); For i:=1 to length(ban1) do begin delay(300); Write(ban1[i]); end; gotoxy(23,5); Textcolor(yellow); for i:=1 to length(ban2) do begin delay(300); write(ban2[i]); end; gotoxy(1,15); n:=1; i:=15; chucmung(n,i); chucmung(n+8,i); chucmung(n+16,i); stop:=keypressed; writeln; Textcolor(LightCyan); Writeln('_________________________________________________'); Writeln(' '); Writeln(' Thanks for taking the time to look at this code '); Writeln(' Code by Lam Tan Dung '); writeln(' Contact: [email protected] '); Writeln('_________________________________________________'); if stop then exit; readln; end.
Write, Run & Share Pascal code online using OneCompiler’s Pascal online compiler for free. It’s a straightforward, accessible way to learn and experiment with Pascal programming right from your browser. OneCompiler supports modern Pascal syntax and provides a ready-to-use editor for immediate execution.
Pascal is a procedural programming language developed in the 1970s by Niklaus Wirth. It was designed to encourage good programming practices and structured programming. Pascal is widely used in teaching computer science fundamentals and has influenced many modern languages.
The following is a simple Pascal program that prints a greeting:
program HelloWorld;
begin
writeln('Hello, OneCompiler!');
end.
OneCompiler’s Pascal editor supports stdin through the I/O tab. Here’s an example that reads a user's name and prints a greeting:
program GreetUser;
var
name: string;
begin
readln(name);
writeln('Hello, ', name, '!');
end.
var
age: integer;
name: string;
score: real;
flag: boolean;
Type | Description |
---|---|
integer | Whole numbers |
real | Floating-point numbers |
char | Single character |
string | Sequence of characters |
boolean | True or False |
if score >= 50 then
writeln('Pass')
else
writeln('Fail');
for i := 1 to 5 do
writeln(i);
i := 1;
while i <= 5 do
begin
writeln(i);
i := i + 1;
end;
i := 1;
repeat
writeln(i);
i := i + 1;
until i > 5;
procedure SayHello;
begin
writeln('Hello!');
end;
function Add(a, b: integer): integer;
begin
Add := a + b;
end;
This guide provides a quick reference to Pascal programming syntax and features. Start coding in Pascal using OneCompiler’s Pascal online compiler today!