.


:




:

































 

 

 

 


қ ұ




ғ - 3

қ 11 -

 

қ (skytale )

( )

:

ө ғ ң:

 

1. ң ң;

2. ң;

3. ң ә құө құғ өң қ.

ә

 

ò:

Program skytale; Type str100 = string[100]; str80 = string[80]; Var inf, outf: str80; sky: str100; t: integer; ch: char; Procedure code(inf, outf: str80); Var infile, outfile: file Of char; t, t2: integer;Begin assign(infile, inf); reset(infile); assign(outfile, outf); rewrite(outfile); t:= 1;{ , } while (Not eof(infile)) and (t<=100) Do Begin Read(infile, sky[t]); t:= t+1; End;{ 520} For t:= 1 To 5 Do For t2:= 0 To 19 Do Write(outfile, sky[t+(t2*5)]); WriteLn(' '); close(infile); close(outfile);End; Procedure decode(inf, outf: str80); Var infile, outfile: file Of char; t, t2: integer;Begin assign(infile, inf); reset(infile); assign(outfile, outf); rewrite(outfile);{ 520 } For t:= 1 To 5 Do For t2:= 0 To 19 Do Read(infile, sky[t+(t2*5)]);{ } For t:= 1 To 100 Do Write(outfile, sky[t]); WriteLn(' '); close(infile); close(outfile);End; Begin{ "#" } For t:= 1 To 100 Do sky[t]:= '#'; Write(' : '); ReadLn(inf); Write(' : '); ReadLn(outf); Write(' (C or D): '); ReadLn(ch); If upcase(ch)='C' Then code(inf, outf) Else If upcase(ch)='D' Then decode(inf, outf);End.

қ ұ

ғ - 3

қ 12 -

 

қ

( )

ө ғ ң:

 

1. ң ң;

2. ң;

3. ң ә құө құғ өң қ.

ә

 

1 (қ )

ò:

Program subst; Type str80 = string[80]; Var inf, outf: str80; start: integer; ch: char; Procedure code (inf, outf: str80; start: integer);Var infile, outfile: file Of char; ch: char; t: integer;Begin assign(infile, inf); reset(infile); assign(outfile, outf); rewrite(outfile); while not eof(infile) Do Begin Read(infile, ch); ch:= upcase(ch); If (ch>='A') And (ch<='Z') Then Begin t:= ord(ch)+start; If t>ord('Z') Then t:= t-26; ch:= chr(t); End; Write(outfile, ch); End; WriteLn(' '); close(infile); close(outfile);End; Procedure decode(inf, outf: str80; start: integer); Var infile, outfile: file Of char; ch: char; t: integer;Begin assign(infile, inf); reset(infile); assign(outfile, outf); rewrite(outfile); while not eof(infile) Do Begin read(infile, ch); ch:= upcase(ch); If (ch>='A') And (ch<='Z') Then Begin t:= ord(ch)-start; If t<ord('A') Then t:= t+26; ch:= chr(t); End; Write(outfile, ch); End; WriteLn(' '); close(infile); close(outfile);End;Begin Write(' : '); ReadLn(inf); Write(' : '); ReadLn(outf); Write(' (1-26): '); ReadLn(start); Write(' (C or D): '); ReadLn(ch); If upcase(ch)='C' Then code(inf, outf, start) Else If upcase(ch)='D' Then decode(inf,outf,start);End.

2 (ұ )

ò:

Program subs1; Type str80 = string[80]; Var inf, outf: str80; alphabet,sub: str80; ch: char; { } Function find(alphabet: str80; ch: char): integer; Var t: integer;Begin find:= -1; { } For t:= 1 To 27 Do If ch=alphabet[t] Then find:= t;End; { TRUE , - } Function isalpha(ch: char): boolean;Begin isalpha:= (upcase(ch)>='A') And (upcase(ch)<='Z');End; Procedure code(inf, outf: str80); Var infile, outfile: file Of char; ch: char;Begin assign(infile, inf); reset(infile); assign(outfile, outf); rewrite(outfile); while not eof(infile) Do Begin Read(infile, ch); ch:= upcase(ch); If isalpha(ch) Or (ch=' ') Then Begin ch:= sub[find(alphabet, ch)]; { } End; Write(outfile, ch); End; WriteLn(' '); close(infile); close(outfile);End; Procedure decode(inf, outf: str80); Var infile, outfile: file Of char; ch: char;Begin assign(infile, inf); reset(infile); assign(outfile, outf); rewrite(outfile); while not eof(infile) Do Begin Read(infile, ch); ch:= upcase(ch); If isalpha(ch) Or (ch=' ') Then ch:= alphabet[find(sub,ch)]; { } Write(outfile, ch); End; WriteLn(' '); close(infile); close(outfile);End; Begin alphabet:= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '; sub:= 'CAZWSXEDCRFVTGBYHNUJM IKOLP'; Write(' : '); ReadLn(inf); Write(' : '); ReadLn(outf); Write(' (C or D): '); ReadLn(ch); If upcase(ch)='C' Then code(inf, outf) Else If upcase(ch)='D' Then decode(inf, outf);End.




:


: 2016-09-06; !; : 444 |


:

:

, .
==> ...

1733 - | 1524 -


© 2015-2024 lektsii.org - -

: 0.008 .