Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program szyfr;
- uses crt;
- var
- b:array[1..26] of char;
- cezar:array[1..999] of char;
- licz,licz2,i,ikon,j,pr:integer;
- s:string;
- c,x:char;
- procedure ramka;
- begin
- writeln(' _____________________________________________________' );
- writeln('| |');
- writeln('| |');
- writeln('| |');
- writeln('|_____________________________________________________|');
- gotoxy(2,6);
- end;
- begin
- clrscr;
- licz:=0;
- for c:='a' to 'z' do
- begin
- inc(licz);
- b[licz]:=c;
- end;
- writeln;
- write('przesuniecie: ');
- readln(pr);
- if pr>26 then
- repeat
- pr:=pr-26;
- until pr<26;
- writeln;
- gotoxy(1,3);
- // writeln('___________________________________________________');
- writeln;
- licz:=1;
- ramka;
- while licz<27 do
- begin
- if (licz+pr)<26 then write(' ',b[licz+pr])
- else if (licz+pr)>26 then write(' ',b[licz+pr-26])
- else write(' z');
- inc(licz);
- end;
- writeln;
- gotoxy(2,7);
- for i:=1 to 26 do
- begin
- write(' ',b[i]);
- end;
- writeln;
- // writeln('___________________________________________________');
- writeln;
- gotoxy(1,11);
- write('co zaszyfrowac?: ');
- readln(s);
- writeln;
- ikon:=length(s);
- for i:=1 to ikon do
- begin
- x:=s[i];
- licz2:=0;
- if s[i]=' ' then
- begin
- cezar[i]:=' ';
- writeln;
- end
- else
- begin
- repeat
- inc(licz2);
- until s[i]=b[licz2];
- if (licz2+pr)<26 then cezar[i]:=b[licz2+pr]
- else
- if(licz2+pr)=26 then cezar[i]:=b[26]
- else cezar[i]:=b[(licz2+pr)-26];
- writeln(x,'->',cezar[i]);
- end;
- end;
- writeln;
- write(s,' -> ');
- for j:=1 to ikon do
- begin
- write(cezar[j]);
- end;
- writeln;
- readkey;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement