.


:




:

































 

 

 

 


input output




input output. Input () , . Output () , . , , :

begin writeln(output,); readln(input); end.

input output , : assign(input,''); reset(input);

assign(output,''); rewrite(output);

.

input output , , . , con , .

. , , read (readln) write (writeln) , , , .

:

Var a,b: integer;

begin

assign(input, 'input.txt'); { input input.txt }

readln(a,b); { , }

assign(output, 'output.txt'); { output output.txt }

writeln(b,a); { , }

end.

input.txt , output.txt, . . ?

, , , . , , assign(input,''); assign(output,'');

. :

var f: text; str: string;

begin

assign(f, ''); reset(f); readln(str); close(f);

assign(f, ''); rewrite(f); writeln(f, ' : ',str); close(f);

end.

, .

 

, , . analysis.txt.

const sum: word=0; { : }

var f1,f2: text; name,str,search: string[80];

begin

write(' : '); readln(name);

write(' : '); readln(search);

assign(f1,name);assign(f2,'analysis.txt');

reset(f1); rewrite(f2); { f1 f2 }

writeln(' :'); writeln(f2,' :');

while not eof(f1) do { f1, }

begin

readln(f1,str); { str f1 }

if pos(search,str)>0 then

begin { search str }

inc(sum); writeln(' ():',sum);

writeln(str); { }

writeln(f2,str); { }

end;

end;

close(f1); close(f2); readln; { }

end.

 

: , . append , , ( ), , .

var ftmp,f: text; { }

txtbuf: string; { }

name: string; { }

ok: boolean; ch: char;

function fileexists(filename: string): boolean;

{ , true, }

var f: file;

begin

{$i-} assign(f, filename); reset(f); {$i+}

fileexists:=(ioresult=0)and(filename<>'');close(f);

end;

begin

{ }

assign(ftmp,'tmpfile.txt'); rewrite(ftmp);

writeln(' . - <Enter>:');

repeat

write('->'); readln(txtbuf); writeln(ftmp, txtbuf);

until txtbuf=''; { <Enter> }

close(ftmp); writeln(' ');

repeat { }

write(' : '); readln(name);

ok:=fileexists(name);

if not ok then writeln(' ',name,' ');

until ok;

writeln(' ',name,' ');

assign(f,name); reset(f); { f }

append(ftmp); { f }

while not eof(f) do

begin

{ , }

readln(f, txtbuf);

if txtbuf<>'' then writeln(ftmp,txtbuf);

end;

close(f); close(ftmp);

writeln(' ',name);

writeln(' :');

writeln(' , - E/e (erase)');

writeln(' , bak- - B/b (backup)');

writeln(' - H/h (halt)');

readln(ch);

case ch of

'E','e':

begin

{ }

erase(f); rename(ftmp,name);

end;

'B','b':

begin

txtbuf:=name; delete(txtbuf,length(txtbuf)-3,4);

rename(f,txtbuf+'.bak'); { bak}

rename(ftmp,name); { }

end;

'H','h':halt;

end;

end.

 

:

q ;

q ;

q ;

q .

, . , , . , . .

:

unit <>; { }

{$R+} { , }

 

interface { }

uses { }

label { }

const { }

t { }

var { }

procedure { }

function { }

 

implementation { }

uses { }

label { }

const { }

t { }

var { }

procedure { }

function { }

begin { }

..... { }

end. { }

 

- , .

Delphi . -, initialization, -, finalization, . , - , . .

:

q , ( );

q , . , , unit triangle, Triangle.pas, ;

q , . . , . ;

q , . , , , , , ;

q , , , . . , ;

q . begin begin end. ( );

q , . . , , . .

, , , . . . - , , .

: uses ;

.

, uses crt, graph, triangle;

 

: triangle, , . : . :

q ;

q ;

q ;

q .

, , - .

unit triangle;

interface

{ }

procedure getabc (xa,ya,xb,yb,xc,yc:real; var a,b,c:real);

{ }

function exist(a,b,c:real):boolean;

{ }

function perimetr(a,b,c:real):real;

{ }

function square(a,b,c:real):real;

{ }

function rv(a,b,c:real):real;

{ }

function ro(a,b,c:real):real;

{ , }

implementation

{ }

function len(x1,y1,x2,y2:real):real;

begin

len:=sqrt(sqr(x1-x2)+sqr(y1-y2));

end;

procedure getabc;

begin

a:=len(xa,ya,xb,yb);

b:=len(xb,yb,xc,yc);

c:=len(xc,yc,xa,ya);

end;

function exist;

begin

exist:=(a<b+c) and (b<a+c) and (c<a+b);

end;

function perimetr;

begin

perimetr:=a+b+c;

end;

function square;

var p:real;

begin

p:=(a+b+c)/2; { p }

square:=sqrt(p*(p-a)*(p-b)*(p-c)); { }

end;

function rv;

begin

rv:=square(a,b,c)/perimetr(a,b,c)*2;

end;

function ro;

begin

ro:=a*b*c/4/square(a,b,c);

end;

begin

{ }

end.

: . , . - . :

q ( );

q (, );

q ( ).

uses triangle;

var xa,ya,xb,yb,xc,yc,

xd,yd,xe,ye,xf,yf,a,b,c,d,e,f: real;

begin

writeln(' ');

readln(xa,ya,xb,yb,xc,yc);

getabc(xa,ya,xb,yb,xc,yc,a,b,c);

if not exist(a,b,c) then

writeln(' ')

{ }

else { }

begin

writeln(' ');

readln(xd,yd,xe,ye,xf,yf);

getabc(xd,yd,xe,ye,xf,yf,d,e,f);

if not exist(d,e,f) then

writeln(' ')

else { }

begin

if perimetr(a,b,c)>perimetr(d,e,f) then write(' ')

else write(' ');

writeln(' ');

if square(a,b,c)>square(d,e,f) then write(' ')

else write(' ');

writeln(' ');

if rv(a,b,c)>rv(d,e,f) then write(' ')

else write(' ');

writeln(' ');

end;

end; readln

end.

 

 

 

1

1. x.txt y.txt. z.txt, x.txt, y.txt. . .

2. . , . , . ( ).

3. , , . , .

4. , . , , . , .

5. . . . .

6. . , 15, : , , , . . ; ( ) .

7. . , 20 , : , , , . . .

8. . ,

9. , . .

10. . , .

11. , . , ( ).

12. , . , .

13. . N, K . . .

14. . N, K . .

15. , , . , , .

 

2

 

1. , ( ) :

.

. ( , )

. ( , ).

, , .

2. , ( ) :

. ( , )

. ( )

.

, , .

3. , ( ) :

. .

. , ( ).

. .

, , .

4. , ( ) :

.

. , .

. .

, , .

5. , ( ) :

. .

. .

. .

, , .

6. , ( ) :

. .

. .

. .

, , .

7. , ( ) :

. .

. .

. .

, , .

8. , ( ) :

.

. ( )

.

, , .

9. , ( ) :

. .

. .

. .

, , .

10. , ( ) :

.

. .

. .

, , .

11. , ( ) :

. .

. .

. .

, , .

12. , ( ) :

.

. ( )

.

, , .

13. , ( ) :

.

. ( , )

. ( , ).

14. , ( ) :

. .

. .

. .

, , .

15. , ( ) :

. .

. , ( ).

. .

, , .

 





:


: 2016-09-03; !; : 1366 |


:

:

- - , .
==> ...

1497 - | 1490 -


© 2015-2024 lektsii.org - -

: 0.121 .