Pascal is a low-level programming language with simple statements for handling basic problems. It is commonly used as a programming language in high school programs to help students develop basic programming skills. However, the new curriculum only introduces a few simple statements. Mytour will provide you with several Pascal functions with various applications.
Input and Output Functions
Utilizes CRT
clrscr() - Clears the entire screen.
textcolor() - Prints text in color.
textbackground() - Sets the screen background color.
sound() - Generates sound.
delay() - Introduces a delay.
nosound - Turns off sound.
windows(x1,y1,x2,y2) - Adjusts the screen window.
highvideo - Increases screen brightness.
lowvideo - Decreases screen brightness.
normvideo - Returns the screen to normal brightness mode.
gotoxy(x,y) - Moves the cursor to position x,y on the screen.
deline - Deletes a line containing the cursor.
clreol - Clears characters from the cursor position to the end without moving the cursor.
insline - Inserts an additional line at the current cursor position.
exit - Exits the program.
textmode(co40) - Generates large font style.
randomize - Initializes random mode.
move(var1,var2,n) - Copies a block of n bytes from variable Var1 to variable Var2 in memory.
halt - Halts program execution and returns to the operating system.
Abs(n) - Absolute value.
Arctan(x) - Returns the arctangent of x.
Cos(x) - Returns the cosine of x.
Exp(x) - Exponential function with natural base e.
Frac(x) - Returns the fractional part of number x.
int(x) - Returns the integer part of decimal number x.
ln(x) - Natural logarithm function.
sin(x) - Returns the sine of x, where x is measured in radians.
Sqr(x) - Square of the number x.
Sqrt(x) - Returns the square root of x.
pred(x) - Returns the integer before integer x.
Suuc(x) - Returns the integer after integer x.
odd(x) - Returns true if x is odd, otherwise false.
chr(x) - Returns a character at position x in the ASCII table.
Ord(x) - Returns the ordinal value of character x.
round(n) - Rounds the real number n.
Random(n) - Generates a random number within the range of n.
upcase(n) - Converts lowercase characters to uppercase.
assign(f) - Creates a file.
rewrite(f) - Initializes.
append(f) - Inserts additional data into the file.
close(f) - Closes the file.
erase(f) - Deletes.
rename() - Renames the file.
length(s) - Returns the length of the string.
copy(s,a,b) - Copies a substring.
insert(,s,a) - Inserts additional content into the string.
delete(s,a,b) - Deletes part of the string.
Unit GRAPH (Graphics Functions)
initgraph(a,b) - Initializes graphics mode.
closegraph; - Closes graphics mode.
setcolor(x) - Selects a color.
outtext() - Prints on the screen at the top left corner.
outtextxy(x,y,); - Prints on the screen at specified coordinates.
rectangle(x1,y1,x2,y2) - Draws a rectangle.
line(x1,y1,x2,y2) - Draws a straight line.
moveto(x,y) - Sets the starting point for drawing a line.
lineto(x,y) - Sets the ending point for drawing a line.
circle(x,y,n) - Draws a circle.
ellipse(x,y,o1,o2,a,b) - Draws an ellipse.
floodfill(a,b,n) - Applies color fill to a shape.
getfillpattern(x) - Creates a variable for filling.
setfillpattern(x,a) - Selects a color for filling.
cleardevice; - Clears the entire screen.
settextstyle(n,a,b) - Selects font style.
bar(a,b,c,d) - Draws a bar.
bar3d(a,b,c,d,n,h) - Draws a box.
arc(a,b,c,d,e) - Draws an arc.
setbkcolor(n) - Fills background color.
putpixel(x,y,n) - Draws a point.
setfillstyle(a,b) - Sets background for the screen.
setlinestyle(a,b,c) - Selects line style.
getmem(p,1) - Allocates memory for data storage.
getimage(x1,y1,x2,y2,p) - Retrieves drawn images within a specified window area.
putimage(x,y,p,n) - Displays on the screen the images stored in memory.
Unit DOS
getdate(y,m,d,t) - Retrieves date data from memory.
gettime(h,m,s,hund) - Retrieves time data from memory.
findnext(x) - Continues searching.
Findfirst($20,dirinfo) - Searches for
Here are some popular functions in Pascal for you to manipulate and use. You can also refer to some basic functions in Excel to apply in your work and study. Excel has many basic functions, so you need to explore and practice regularly to perform calculations more accurately.