- . : {$+} {$-}. {$+}. , -, . , .
{$} {$-}, - , - . , IOResult. 0, - , , . ϳ . , - {$} , .
. , . , . . . t. ,
Var f:Text.
, FilePos, FileSize Seek. .
Assign, Close, Reset, Rewrite . Read Write .
Read(Var f:Text;Var a1,,an:anytype) f . anytype , , . ij Read , . - . Read Eof ru, Chr($1) ( ^Z e), Eoln ru ( - Eof False), hr($0D) hr($0A) ( r ).
- Read , . -, .
- Read , . , , , . , , , . , -.
|
|
- Read , . , , , . , , , , . , -.
Readln(Var f:Text; Var a1,,an:anytype) , Read, , , , , . Readln - . Readln(f,a,b) ;
begin Read(f,a);Read(f,b);Readln(f) end;.
Write(Var f:Text; Var a1,,an:anytype) , f, . anytype , , , . Write . .
Writeln(Var f:Text; Var a1,,an:anytype) , Write, . Writeln - .
, (con, com1, lpt1 . .) Turbo Pascal Readln Writeln .
, Readln(Con) Readln , Writeln(Lst) .
Eof(f:text):Boolean Eof .
Eoln(f:text):Boolean ru, , False .
SeekEof(f:text):Boolean , Eof, , .
SeekEoln(f:text):Boolean , Eoln, .
Turbo Pascal , . ֳ , , .
File (: Var f: File;). , Read, Write Flush. , ᒺ 128 . ϳ Seek . , Seek(f,2) ( 256..383). 128 . BlockRead BlockWrite.
|
|
BlockRead(Var f: File; Var v:anytype; n:Integer; Var m:Integer) n 128 f. , v (anytype - .). m , . m<n, , .
BlockWrite(Var f: File; Var v:anytype; n:Integer; Var m:Integer) n 128 f. , , , v (anytype - ). m . m<n , .
1. .
2. .
3. , , , , .
- Pascal .
1. , . : , , , ( , ..). ʳ .
2. -, . : , (n-p-n, p-n-p), , -, . ʳ .
3. , . : , , , , . ʳ .
4. , . : , , , , . ʳ .
5. , . : , , ` ` ( , ). ʳ .
6. , . : , , , . ʳ . , , .
7. -, . : , , , , . ʳ .
8. , . : , , , , . ʳ .
9. , sin(x), cos(x), tg(x) x 0 314 0.5.
10. , . : , , .
ֲ
1. .
2. .
3. .
4. , , , -, ( ), ( ).
|
|
5. , .
6. ϳ .
1. . : , , .
- :
˳ :
Program myProgram;
uses crt;
type tov=record
nazva: string;
kilk: integer;
cina: real; end;
var f: file of tov; x: tov;
begin
Assign (f,'market.dat'); Rewrite (f);
repeat
writeln ('Vvedit informaziju pro tovar');
write ('Nazva:'); readln (x.nazva);
write ('Kilkist:'); readln (x.kilk);
write ('Cina:'); readln (x.cina);
write (f, x);
writeln ('Dlja vuxody natusnit [ESC]');
until readkey=#27; close (f); end.
:
2. , ': , (hdd), ' (ram) (speed). .
˳ :
Program Computer1;
uses Crt;
type comp=record { , }
marka:string[15]; { '}
hdd, ram:real; speed:integer;
end;
myfile=file of comp;
var f1:myfile; i,n:integer;
c1:comp;
begin
clrscr;
writeln ('Yvedit kilkist kompjyteriv'); readln(n);
assign(f1, 'd:\computer');
rewrite(f1); {³ f1 }
for i:= 1 to n do
begin
writeln('Yvedit marky kompjytera:');
readln(c1. marka);
writeln('Yvedit obsjahu joho HDD ta RAM:');
readln(c1.hdd, c1.ram);
writeln('Vvedit shvudkodijy:'); readln(c1.speed);
write(f1, c1); { f1}
end;
close(f1); { f1}
writeln (' Marka Obsjah vin4estera RAM Shvudkodija');
reset(f1); {³ }
for i:=1 to n do { }
begin
read(f1, c1); { }
writeln(c1.marka:15, c1.hdd:17, c1.ram:4, c1.speed:10);
end; readln; end.
:
1. .
2. - ?
3. ?
4. ?
5. ?
6. .
7. ?
8. ?
____________ . .