The assignment operator in Pascal: what it is intended for, what actions it performs

Turbo Pascal is a simple programming language, but learning it is time consuming if you take this issue seriously. A novice user learns the basics of code from the simplest. So, for example, he first learns what actions the assignment operator performs, why it is needed, how to display a string or variables. Only then will the programmer turn to procedures and functions, work with character and string data types, files, and graphics. So what is an assignment operator? What is its role in writing code?

assignment operator




Organization of the Turbo Pascal application working window

Before starting to study the theoretical material, which actually includes the question of what is an assignment operator, you need to look around in the Turbo Pascal workspace.

The application menu consists of the following sections:

  • File – (, , , ..).
  • Edit – (, , ..).
  • Search – .
  • Run – , .
  • Compile – .
  • Debug – .
  • Tools – .
  • Options – .
  • Window – .
  • Help – .

Pascal ABC. , .





Turbo Pascal

pascal assignment operator




, . , :

Program primer; //

Uses crt; //

Label metka1; //

Const number=10; //

Type newtype=set of string; //

Var a: integer; b:real; c:newtype; d:boolean; e:char; //

----------------------------------- //

Begin

{ } //

End.

.

. .

Turbo Pascal : . :

  • ;
  • ;
  • ;
  • ;
  • ;
  • .

.

: var < >: . : const < >=.





< > .

, , . , Turbo Pascal, :

  • ;
  • ;
  • ;
  • ;
  • ;
  • ;
  • ;
  • ( , , ).

, , , , .. , . . , , «;», .. . , . «»: else.

read() readln(). : read(a); readln(a,b); readln(d).

write() writeln(). : write(a,g); writeln(‘ ’); write(‘ S=’, S); write(f:6:3).

readln end. . PascalABC readln .

clrscr, crt. -, .

. – . «», .. «:=». .

? : , . , , , «:=».

:

  • ← .

:

  • A:=b+c/2;
  • b:=n;
  • n:=b;
  • x:=15;
  • x:=x+3.

, «b:=n» «n:=b» .

, , «:=» ( «») . : 100%-. , , . .. « := » .

what is the assignment operator intended for




, , . , .

1

. L . S, .

Algorithm of actions:

  • Calculate the radius value based on the circumference formula.
  • Set the circle area formula.
  • Display the result on the screen.

assignment operator has the form




Task 2

A truncated cone is given. The user sets the values ​​of the radii of the bases Rb, Rm and height h. Using the formulas and set values, calculate the volume and surface area of ​​the figure.

what actions does the assignment operator perform




Algorithm of actions:

  • Enter the required data using the keyboard.
  • Define formulas for finding the volume and surface area of ​​a truncated cone.
  • Calculate V and S.
  • Display them on the screen.




All Articles