. - 3GL   - 4GL   5GL  

3GL

() , . , . , , , . , , -: , , , , , . . , - .

, , , , - :

, . , , , 85 , , 60 , . QBasic , .

. , , k , , :

( ), .

. , , , . , , " ", " ", " ", .

, , . (DIRECT ACCESS) (RANDOM ACCESS). , . , . .

, . , .

, . , , (" ", " ", " ", " "). .

, , , .

QBasic

QBasic , . , .

QBasic

, OD (" ") OA (" "). , . , . , . ODOA.

:

OPEN _ FOR OUTPUT AS #k

, FOR APPEND. , , FOR INPUT.

[1,255], (INPUT) (PRINT, WRITE). tt .

CLOSE tk.

, , WRITE Ik. . INPUT #k , .

, PRINT#k. . , . 7_01.bas.

7_01.bas

CLS : DEFINT A-Z: $="" OPEN "bas_txt"

FOR OUTPUT AS #1 FOR J=l TO 10

PRINT #1,A$;J,J*2

PRINT A$;J,J*2

NEXT J

CLOSE #1

PRINT

OPEN "bas_txt"

FOR INPUT AS #2

FOR J=l TO 10

INPUT #2,B$,K1,K2

PRINT B$;K1,K2

NEXT J

CLOSE #2

END

, bas_txt 10 , , . bas_txt, , F3, , :

1 2

2 4

3 6

4 8

5 10

6 12

7 14

8 16

9 18

10 20

, PRINT " " , "+" . 15- ( "+"). "" PRINT. (F3 -> F4), : ASCII (1 -> 31, 2 -> > 32, ...), (10 > 3130, 12 -> 3132, ...). , -ODOA. , , + .

. -, input paste end of file, . -, , :

1 2 0 2

4 0 3

6 0 4

..............

. $ 16 , (BASIC- , ). ODOA $ , . KI . () ( ), , KI (KI = ). 2 (2 = 2). $ , ($ = "4"). , .

- , , .

, , WRITE #k. 7_02.bas bas_txt:

7_02.bas

CLS : $ = ""

OPEN "bas_txt" FOR OUTPUT AS #1

FOR J%=1 TO 10

WRITE #1,A$,J%,SQR(J%)

PRINT A$,J%,SQR(J%) NEXT J%

CLOSE #1

PRINT

OPEN "bas_txt"

FOR INPUT AS #2

FOR J%=1 TO 10

INPUT #2,B$,I%,R

PRINT B$,I%,R NEXT j% CLOSE #2

END

QBasic

"", . . , , . .

TYPE END TYPE. 7_03.bas qq , (6- ), (2- ) (4- ). DIM qq, b., b.n b.r. :

PUT #l,,b ' b

PUT #l,5,b ' b 5

1. , :

OPEN "bas_rec" FOR RANDOM AS #1 LEN=12

(LEN=12) , , , .

7_03.bas , , .

7_03.bas

CLS TYPE qq

a AS STRING *6

n AS INTEGER

r AS SINGLE END TYPE DIM b AS qq b.=""

OPEN "bas_rec" FOR RANDOM AS §1 LEN=12

FOR J%=1 TO 10

b.n=J% : b.r=SQR(J%)

PUT #l,,b

PRINT b.a,b.n,b.r NEXT J% CLOSE #1

OPEN "bas_rec" FOR RANDOM AS #1

FOR J%=10 TO 1 STEP -1

GET #l,J%,b

PRINT b.a,b.n,b.r

NEXT J%

CLOSE #1

END

QBasic

, 1. :

OPEN _ FOR BINARY AS #k

PUT ( ) GET ( ). , . , , . , ( GET/PUT ), () .

7_04.bas "", j%

j%, .

7_04.bas

CLS : $=""

OPEN "bas_bin" FOR BINARY AS #1

FOR J%=1 TO 10

B=SQR(J%)

PUT #1,,A$: PUT #1,,J% : PUT #1,,B

PRINT A$, J%, NEXT J% CLOSE #1 PRINT

OPEN "bas_bin" FOR BINARY AS #1

FOR J%=10 TO 1 STEP -1

GET #1,(J%-1)*12+1,A$

GET #1,(J%-1)*12+7,K%

GET #1,(J%-1)*12+9,B

PRINT A$,K%,B

NEXT J%

CLOSE #1

END


BASIC, - (), () ().

()

, , 255 ODOA. QBasic, . , .

(f1:text;), (assign(f1, 'pas_txt') ;) (rewrite(fl);), (append(f1);) (reset(f1),-). close (f1);.

- string writein. , , write, writein, .

readin string. , , . . readin , readin , . . . , . , , .

7_01.pas , 7_01.bas. ( ) ki . Basic invalid numeric format ( ) readin.

7_01.pas

program bad_file;

uses Crt;

var

j,kl,k2:integer;

f:text;

b:string; begin

clrscr;

assign(f,'pas_txt') ;

rewrite(f);

for j :=1 to 10 do

begin

writeln('',j:4,j*2:4);

writeln(f, '', j:4,j *2:4) ;

{ write(f,'');

write(f,j:4);

writeln(j*2:4};

} end;

close(f);

writeln;

reset(f);

for j:=1 to 10 do begin

readln(f,b,kl,k2);

writeln(b,kl:4,k2:4);

end;

close(f);

readln;

end.

7_02.pas , . .

7_02.pas

program txt_file;

uses Crt;

var

j,k1,k2:integer;

f:text;

b:string; begin

clrscr;

assign(f,'pas_txt');

rewrite(f);

for j:=1 to 10 do

begin

writeln(f,j:4,j*2:4,'':8);

writeln(j:4,j*2:4,'':8);

end;

close (f) ;

writeln;

reset(f);

for j:=1 to 10 do begin

readln(f,kl,k2,b);

writeln(kl:4,k2:4,b:8);

end;

close(f);

readln;

end.

()

:

type

qq=record

a:string[6];

n:integer;

r:real;

end;

(fl:fiie of qq;), (assign(f1, 'pas_rec') ,-). reset (f1), rewrite (f1),. - read/write, "". 0 . :

seek(f1,_);

7_03.pas ( 6- , , ) . .

7_03.pas

program rec_file;

uses Crt;

type

qq=record

a:string[6];

n:integer;

r:real; end; var

f1:file of qq; j,kl: integer;

rec:qq; d:real;

begin clrscr;

assign (fl, 'pas__rec') ;

rewrite(fl);

rec.a:='';

for j:=1 to 10 do begin

rec.n:=j;

rec.r:=sqrt(j);

write(fl,rec);

writeln(rec.a,rec.n:4,rec.r:10:4);

end;

close(fl);

writeln; reset(fl);

for j:=9 downto 0 do begin

seek(fl,j);

readffl,rec);

writeln(rec.a,rec.n:4,rec.r:10:4);

end;

readln;

end.

()

() (f1:fie;), (rewrite (f1,n);) (reset(f1,n);). , 128. , , . blockread blockwrite:

blockwrite(f1,buf,n_rec,vl);

blockread(f1,buf,n_rec,vl);

buf ( byte), , , . _ , . vl . n_ vl . . , :

seek(f1,n_rec);

"" , , 0.

7_04.pas 10- , buf ( 15 ). , . , . "", , buf , .

7_04.pas

program bin_file;

uses Crt;

var

buf:array [1..15] of byte;

f1:file;

:pointer;

s:^string;

pk:^integer;

pr:^r1;

j:integer;

begin clrscr;

p:=@buf[l];

ps:=p;

p:=@buf[8];

pk:=p;

p:=@buf[10J;

pr:=p;

assign(f1,'pas_bin') ;

rewrite(fl,15);

ps^:='';

for j:=1 to 10 do begin

pk^:=j;

pr^:=sqrt(j) ;

blockwrite(f1,buf,1);

writeln (s^,^: 4,^ : 10: 4) ;

end;

close(f1);

writeln;

reset(f1,15);

for j:=9 downto 0 do begin

seek(f1,j);

blockread(f1,buf,1);

writeln(s^,k^:4,pr^:10:4);

end;

close(f1);

readln;

end.


Borland , , . .

()

/ fprintf. ODOA, \.

FILE ("rt" , "wt" - , "at" ) f open:

FILE *f1;

f1=fopen(_, "");

:

fprintf(f1,"_ \n",_);

str, fprintf (fi, "%s\n",str) fputs (f1, str).

fscanf(f1,"_", _) fgets(str,n,f1). n , .

open, creat, read, write,

7_02.

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

main( ) {

FILE *f;

int j,k;

float d;.

char s[7]="";

f=fopen("c_txt","wt");

for(j=l;j<11;j++)

{

fprintf(f,"%s %d %f\n",s,j,sqrt(j));

fprintf("\n %d %n",j,sqrt(j)); }

fclose(f); fprintf("\n");

f=fopen("c_txt","rt");

for(j=10; j>0; j--) {

fscanf(f,"%s %d %f",s,&k,&d);

fprintf("\n%s %d %f",s,k,d); }

getch () ; }

7_01.. % %d , "" . s "!", "2", ..., "", k j ( ""), d .


, , .

FILE ("rb" , "wb" , "ab" ) f open:

FILE *f11;

f1=fopen(_, "");

:

fwrite(buf, size_rec, n_rec, f1) ;

size_rec , _ , . f read:

fread(buf, size_rec, n_rec, f1);

7_02. b, (b.s, 7 , ), (b.n, 2 ) (b.r, 4 ) , . . fseek , . SEEK_SET , . SEEK_END, SEEK_CUR.

7_03.

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

#include <string.h>

main( ) {

FILE *fl; int j, k;

struct { char s [7]; int n; float r; } b;

clrscr();

strcpy(b.s,"");

fl=fopen("c_rec","wb");

for(j=l;j<ll;j++)

{

b.n=j; b.r=sqrt(j);

fwrite(&b,sizeof(b),l,fl);

printf("\n%s %d %f",b.s,b.n,b.r);

}

fclose(fl); printf("\n");

fl=fopen("c_rec","rb");

for(j=10; j>0; j ) {

fseek(fl,(j-1)*sizeof(b),SEEK_SET);

fread(&b,sizeof(b),l,f1);

printf("\n%s %d %f",b.s,b.n,b.r);

}

getch();

}


, , - , .

{fopen/fciose, fread/fwrite}, Borland -

{_dos_open/_dos_close, _dos_read/_dos_write}, (_creat/_close, _read/_write}.

.

7_04.

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

main ( ) {

FILE *f1; int j, k;

char s[7]="";

int n;

float r; clrscr. () ;

fl=fopen("c_bin","wb");

for(j=l;j<11;j++) {

r=sqrt(j);

fwrite(s,sizeof(s),1,f1);

fwrite(&j,sizeof(int),1,f1);

fwrite(&r,sizeof(float),1,f1);

printf("\n%s %d %f",s,j,r); }

fclose(f1l); printf("\n"); fl=fopen("c_rec","rb"); for(j=10; j>0; j--) {

fseekffl,(j-1)*(sizeof(s)+sizeof(int)+sizeof(float)),

SEEK_SET);

fread(&s,sizeof(s),1,fl);

fread(&n,sizeof(int),1,f1);

fread(&r,sizeof(float),1,f1);

printf("\n%s %d %f",s,n,r); }

getch(); }

,

7.05. MS-DOS Windows

, MS-DOS, 1251 Windows. , , .

1 ()

-- 256- . j j-o , .

2 ()

:

3 ()

, 256 . , , to_win.

4 (, )

. , . , tmpwin. txt.

7_05.bas

DECLARE SUB TOWIN(T01251() AS INTEGER)

DIM T0125K256) AS INTEGER

INPUT " - ",SOURCE$

TOWIN T01251()

OPEN SOURCE$ FOR INPUT AS #1

OPEN "TMPWIN.TXT" FOR OUTPUT AS #2

DO WHILE NOT EOF(l)

LINE INPUT #1, A$

FOR J=l TO LEN(A$)

MID$ (A$, J, 1) =CHR$ (T01251 (ASC (MID$ (A$, J, 1) ) ) )

NEXT J

PRINT #2, A$

LOOP

CLOSE 1,2

END

SUB TOWIN(T012510 AS INTEGER)

' ASCII

FOR J=0 TO 127: T01251(J)=J: NEXT J

' 64 "" "n"

FOR J=128 TO 175: 01251{J)=J+64: NEXT J

' "+"

FOR J=176 TO 223: 01251(J)=ASC("+"): NEXT J

'

t01251(179)=ASC("|")

'

t01251(186)=ASC("|")

'

t01251(196)=ASC("-")

'

t01251(205)=ASC("=")

' 16 "" ""

FOR J=224 TO 239: 01251(J)=J+16: NEXT J

t01251(240)=168: ' ""

t0125241) =184: ' ""

END SUB

7_05.

#include <stdio.h>

#include <conio.h>

#include <string.h>

void to_win(void);

unsigned char to!251[256];

main(int narg, char **argv) {

FILE *fin,*fout;

unsigned char str[80],source[80];

int j,len;

if(narg==2) strcpy(source,argv[l]);

else {

printf("\n - ");

scanf("%s",source); }

to_win();

fin=fopen(source,"rt");

fout=fopen("tmpwin.txt","wt");

while (Ifeof(fin)) {

fgets(str,80,fin);

len=strlen(str);

for(j=0; j<len; j++)

str[j]=to!251[str[j]];

fputs(str,fout);

}

fcloseall() ;

}

/*------------------------------------*/

void to_win(void) {

/* MS-DOS Windows */

int i ; /* ASCII */

for (i=0; i<128; i++) to1251[i]=i;

/* 64 "" "n" */

for(1=128; i<176; i++)

to1251[i]=i+64;

/* "+" */

for(1=176; i<224; i++) to1251 [!] = ' + ';


/* */

to1251[179]='|'; /* */

to1251[186]='|'; /* */

to1251[196]='-'; /* */

to1251[205]='='; /* 16 "" "" */

for(i=224; 256; i++)

to1251[i]=i+16;

to1251[2401=168; /* "" */

to1251[241]=184; /* "" */

return; }

7_05.pas

program translate; var

to1251:array [0..255] of char;

fin,fout:text;

str:string[803;

source:string[80];

j,len:integer; procedure to_win;

var

i:integer; begin

for i:=0 to 127 do

to1251[i]:=chr(i);

for i:=128 to 175 do

to1251[i]:=chr(1+64);

for i:=176 to 223 do

to1251[i]:='+';

to1251[179]:='|';

to1251[186]:='|';

to1251[196]:= '-';

to1251[205]:= '=';

for i:=224 to 239 do

to1251[i]:=chr(i+16);

to1251[240]:=chr(168);

to1251[241]:=chr(184);

end;

begin

if(ParamCount=2) then source:=ParamStr(1)

else begin

write(' - ');

readln(source);

end; to_win;

assign(fin,source);

reset(fin);

assign(fout, 'tmpwin.txt');

rewrite(fout);

while (not eof(fin)) do begin

readln(fin,str);

len:=length(str);

for j:=0 to len do

str[j]:=to1251[ord(str[j])];

writeln(fout,str);

end;

close (fin);

close(fout);

end.

7.06.

, , . .

1 (QBasic)

WRITE #, . . .

3 ()

. append /. , notebook . , , , - . .

7_06.bas

CLS

OPEN "notebook" FOR APPEND AS #1

'

DO

INPUT ": ",Name$

INPUT ": ",Phone$

WRITE #1, Name$,Phone$

INPUT " ";R$

LOOP WHILE LEFT$(R$,l)="f1"

CLOSE #1

CLS

OPEN "notebook" FOR INPUT AS #1

PRINT " :"

DO WHILE NOT EOF(l)

'LINE INPUT #1, NP$ '

'PRINT NP$ '

INPUT #1, $, $ '

PRINT $, $' '

LOOP

CLOSE #1

END

7_06.

#include <conio.h>

#include <stdio.h>

main() {

FILE *f;

int k;

char r,Name[20],Phone[10]; clrscr();

'f=fopen("notebook","at");

m: /* */

printf("\n : ");

scanf("%s",Name); printf(": ");

scanf("%s",Phone);

fprintf(f,"%-20s %10s\n",Name,Phone);

printf(" (/) - ");

r=getche(); if(=='')

goto m;

fclose(f);

clrscr();

f=fopen("notebook","rt");

printf("\ :\n") ;

while(!feof (f)) {

fscanf(f,"%20s %10s\n",Name,Phone);

printf("%-20s %10s\n",Name,Phone); }

fclose(f);

getch(); }

7_06.pas

program notebook;

uses Crt;

var

f:text;

R,Name,Phone:string; begin

clrscr;

assign(f, 'notebook ');

{$!-} append(f); {$!+}

if IOResult <> 0 then rewrite(f);

{ }

repeat

write(': ');

readln(Name);

write(': ');

readln(Phone);

writeln(f,Name, ' ':15-length(Name), Phone:10);

write{' ');

readln(R);

until r[l] <> ' ';

close(f);

clrscr;

reset(f);

writeln(' : ');

repeat

readln(f,r);

{ } writeln(r);

{ } until eof(f);

close(f);

readln;

end.

7.07.

, bak.

1 ()

(" "), (" "), 1 (" ") .

2 (QBasic)

, .

3 ()

strchr (namel,'.') . , , namel . strchr NULL. strncpy name2 '.' ( 0x0).

4 ()

/ ({$!-}) , . fsplit

, (Dir), (Name) (Ext). , 32 768 ( 512 , . . ).

7_07.bas

CLS : DIM k AS STRING*!

INPUT " - ", NAME1$

OPEN NAME1$ FOR BINARY AS #1

= INSTR(NAME1$, ".")

IF = 0 THEN NAME2$ = NAME1$

ELSE NAME2$ = LEFT$(NAME1$, - 1)

NAME2$ = NAME2$ + "."

PRINT NAME2$,

OPEN NAME2$ FOR BINARY AS §2

DO

GET fl, , k

PUT #2, , k

LOOP UNTIL (EOF(l))

END

7_07.

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#define N 512

main(int narg, char **argv) {

FILE *f1,*f2;

int rd,wr;

char buf[N];

char namel[80],name2[80];

char *point;

if(narg < 2)

{ printf("\n He "); exit(0); }

strcpy(namel,argv[l]);

fl=fopen(namel,"rb");

if(fl==NULL)

{ printf("\n %s ",namel); exit(0); }

point=strchr(namel, '. ');

if(point) {strncpy(name2,namel,point-namel};

name2[point-namel]=0x0; }

else strcpy(name2,namel); strcat(name2,".bak");

f2=fopen(name2,"wb");

do {

rd=fread(buf,l,N,fl);

wr=fwrite(buf,1,rd,f2); }

while (rd!=0 && rd == wr) ;

fclose(fl);

fclose(f2); }

7_07.pas

program reserve; uses Dos; const

N=512; var

fl,f2 : file;

rd,wr : word;

buf : array [1..N] of byte;

namel, name2 : PathStr;

dir : DirStr;

name : NameStr;

ext : ExtStr; begin

if ParamCount=0 then

begin writeln('He ');

exit;

end;

namel:=ParamStr(1);

assign(f1,name1);

{$!-} reset(f1,l); {$I+}

if IOResult <> 0 then

begin writeln(' ',namel, ' ');

exit;

end;

fsplit(namel,dir,name,ext);

name2:=dir+name+'.bak';

assign(f2,name2);

rewrite(f2,1); repeat

blockread(fl,buf,N,rd);

blockwrite(f2,buf,rd,wr);

until (rd=0) or (rd <> wr) ;

close(fl);

close(f2);

end.

7.08.

, (, *.pas) MS-DOS (dir *.pas), .

1 (QBasic)

QBasic MS-DOS, . , Basic SHELL. 7_07.bas , .

2 ()

findfirst(char *path, struct ffblk sr, int attr) findnext (struct ffblk sr}. path ( "*."), ( ": \bc\source\* .") ( "c:\bc"). sr ffblk, . dir. h :

struct ffblk {

char ff_reserved[21]; //

char ff_attrib; //

unsigned ff_ftime; //

unsigned ff_fdate; //

long ff fsize; //

char ff_name[13]; //

};

, , , dos. h :

f indf irst ( ) findnext ( ). sr . , . , -1.

3 ()

, . . . 7_07. , (struct dat) (struct tim). ( ). union (unsigned) , . , v.d , v.c.day. v..year , MS-DOS , 1980.

, , , .

4 ()

FindFirst(path, .attr, sr) FindNext(sr),

DOS. path (, "*.pas"), (, ": \tp\source\* .s") (, "c:\tp"). , , , :

sr searchRec, . DOS :

type

SearchRec=record

Fill:array [1..21] of byte;

Attr:byte; { }

Time:longint; { }

Size:longint; { }

Name:string[12]; ( } end;

FindFirst ( ) FindNext ( ). sr . , DosError . , DosError 18.

5 ()

UnpackTime, , , DateTime, Dos. (k < 10) , , , . Zero.

7_08.bas

SHELL "dir *.bas" END

7_08.

#include <stdio.h>

#include <conio.h>

#include <dir.h>

#include <dos.h>

main() {

struct ffblk sr;

int k,nf=0;

long lf=0;

struct tim

{

unsigned sec:5;

unsigned min:6;

unsigned hour:5;

};

struct dat {

unsigned day:5;

unsigned month:4;

unsigned year:7;

};

union {struct tim a;

unsigned b;}u;

union {struct dat c;

unsigned d; }v;

clrscr();

printf(" ");

k=findfirst("*.c",&sr,FA_ARCH);

while (k==0) {

u.b=sr.ff_ftime; v.d=sr.ff_fdate; nf++;

lf+= sr.ff_fsize;

printf("\n%12s %61d ",sr.ff_name,sr.ff_fsize) ;

printf(" %02d/%02d/%4d ",v.c.day,v.c.month,1980+v.c.year);

printf(" %02d:%02d",u.a.hour, u.a.min);

k=findnext(Ssr); }

printf("\n%d %ld ",nf,If);

getch(); }

7_08.pas

program dir;

uses Crt,Dos; var

dt:DateTime;

sr:SearchRec;

const

nf:integer=0;

If:longint=0;

function Zero(k:byte):string;

var

s: string;

begin

Str(k,s);

if k>9 then Zero:=s else Zero:= '0 '+s; end;

begin clrscr;

writeln(' ');

FindFirst('*.pas',AnyFile,sr);

while DosError=0 do

begin with sr,dt do

begin inc(nf);

If:=lf+Size;

UnpackTime(Time, dt);

write (Name:12, ' ',Size:6, ' ');

write(Zero(Day), '/',Zero(Month), '/',Year:4, ' ');

writeln(Zero(Hour), ': ',Zero(Min), ': ',Zero (Sec)); end;

FindNext(sr); end;

writeln(nf, ' ',1f, ' ');

readln; end.

7.09.

. PRINT COPY.

1 (QBasic)

LINE INPUT, - .

2 ()

ind_copy str , .

3 ()

. 7_08.pas . , . 7_08a.pas, , , eoln (f1) . , , . .

7_09.bas

INPUT " - ", NAME1$

INPUT " - ", NAME2$

INPUT " - ", N%

OPEN NAME1$ FOR INPUT AS #1

OPEN NAME2$ FOR OUTPUT AS #2

DO WHILE NOT EOF(l)

LINE INPUT #1,A$: A$=SPACE$(N%)+A$

PRINT #2,A$

LOOP

CLOSE II: CLOSE #2

END

7_09.c

#include <stdio.h>

#include <stdlib.h>

void ind_copy(FILE *fl,FILE *f2,int n);

main(int narg, char **argv) {

FILE *fl,*f2; int n;

if(narg < 4) {

printf("\n . :"};

printf("\n7_09.exe 1 2 n");

exit(0); }

f1l=fopen(argv[l],"rt");

f2=fopen(argv[2],"wt");

n=atoi(argv[3]};

ind_copy(fl,f2,n);

fcloseall();

}

/*-------------------------------------*/

void ind_copy(FILE *fl,FILE *f2,int n) {

char str[80]; int j;

for(j=0; j<n; j++) str[j]=' ';

while (Ifeof(fl)) {

fgets(&str[n],80,fl);

fputs(str,f2); }

return; }

7_09.pas

program indent;

var

f1,f2:text;

namel,name2:string;

n,k:integer;

procedure ind_copy(var fl,f2:text;n:integer);

var

str:string; begin

while not eof(fl) do

begin

readln(fl,str);

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

end;

end;

begin

if ParamCount < 3 then begin

writeln(' . : ');

writeln('7_09.exe 1 2 ');

exit;

end;

namel:=ParamStr(1);

name2:=ParamStr(2);

Val(ParamStr(3),n,k);

assign(fl,namel);

reset (fl);

assign(f2,name2);

rewrite(f2);

ind_copy(f1,f2,n);

close(f1);

close(f2); end.

7_09a.pas

program indent1; var

f1,f2:text; namel,name2:string;

n,k:integer;

procedure ind_copy(var f1,f2:text;n:integer) ;

var

ch:char;

begin

while not eof(fl) do begin

write(f2, ' ':n);

while not eoln(f1) do begin

read(fl,ch); write(f2,ch);

end;

readln(f1); writeln(f2);

end;

end;

begin

if ParamCount < 3 then begin

writeln(" . : ');

writeln('7_09a.exe ! 2 ');

exit;

end;

narnel:=ParamStr(1);

name2:=ParamStr(2);

Val(ParamStr(3),n,k);

assign(fl,namel);

reset(f1);

assign(f2,name2);

rewrite(f2);

ind_copy(f1,f2,n);

close(fl);

close(f2);

end.

      . - 3GL   - 4GL   5GL  

, Polymorphism, - - , .




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution