.


:




:

































 

 

 

 


, . .

Pascal, .

, , . , , . . , , , .

. , , , .

( ):

(text);

(file of <>);

(file).

. .

Assign(< >, < >)

Assign . , Fil lot, D, :

Assign(Fil, D:\lot.txt)

Reset(< >)

Reset , Read(< >, < >) .

OF(< >)

, . EOF, , , True, False. , , , EOF.

Rewrite(< >)

, , Write(< >, <>).

Close(< >)

Close , , .

Erase(< >)

Erase, , .

Rnm(< >, < >)

Rnm , Close.

Sk(< >, < >)

Sk ( ).

FilePos(< >)

FilePos , .

FileSize(< >)

FileSize .

(char) (string) . Text , :

Var <>: Text;

, . , . EOF, EOLn:

EOLn(< >)

( EOLn) True, False.

 

Pascal:

1. X M. X Y , . Y.
M = (0,1; 5,6; 0.8; 2,4; 7,3; 6,8; 0,5; 2,3;)

const M: array[1..8] of real = (0.1, 5.6, 0.8, 2.4, 7.3, 6.8, 0.5, 2.3);
var
x,y: file of real;

n: real; i: byte;
begin
assign(x,'x.dat');
assign(y,'y.dat');
rewrite(x);
for i:=1 to 8 do
write(x, M[i]);
close(x);
reset(x);
rewrite(y);
i:= 1;
while not EOF(x) do begin
read(x, n);
if not odd(i) then
write(y, n);
i:= i + 1;
end;
close(x); close(y);
reset(y);
while not EOF(y) do begin
read(y, n);
write(n:5:1);
end;
writeln;
close(y);
end.

, . .

var
f: file of char;
c: char; sum, n: word;

begin
assign(f,'nums.txt');
reset(f);
sum:= 0;
while not eof(f) do begin
read(f,c);

if c <> ' ' then begin
val(c, n);
sum:= sum + n;
end
else begin
write(sum:5);
sum:= 0
end;
end;

writeln;
end.



<== | ==>
. | - 2
:


: 2016-12-31; !; : 2732 |


:

:

, .
==> ...

1332 - | 1255 -


© 2015-2024 lektsii.org - -

: 0.009 .