Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program GiaiMa;
- uses crt;
- type mang=array[1..20] of string;
- var
- F,F2: Text;
- path,path2,temp: string;
- s: mang;
- ch:char;
- i,j,lech:byte;
- {*****DAO NGUOC CHUOI*****}
- function nguoc(str: string):string;
- var
- i:byte;
- begin
- nguoc:='';
- for i:=length(str) downto 1 do nguoc:=nguoc+str[i];
- end;
- {*****QUAY VONG *****}
- function vong(str: string; v:byte):string;
- var i,so:byte;
- begin
- vong:='';
- for i:=1 to length(str) do
- begin
- so:=ord(str[i]);
- if (so>=65) and (so<=90) then
- begin
- so:=(so-65-v+26) mod 26 + 65;
- vong:=vong+chr(so+32);
- end
- else
- begin
- vong:=vong+chr(so);
- end;
- end;
- end;
- begin
- clrscr;
- {write('Nhap path file: ');='mao.txt';
- readln(path);}
- path:='/home/thieumao/Desktop/doanma.txt';
- assign(F, path);
- reset(F);
- i:=0;
- writeln('***BAN MA***');
- while (not eof(f)) do
- begin
- while (not eoln(F)) do
- begin
- i:=i+1;
- readln(F,s[i]); writeln(i:2,' ',s[i]);
- end;
- {readln(F); writeln;}
- end;
- close(F);
- writeln;
- lech:=2;
- writeln('***BAN RO***');
- path2:='/home/thieumao/Desktop/giaima.txt';
- assign(F2, path2);
- rewrite(F2);
- for j:=1 to i do
- begin
- writeln(F2, vong(s[j],lech) );
- writeln(j:2,' ', vong(s[j],lech) );
- end;
- close(F2);
- end.
Advertisement
Add Comment
Please, Sign In to add comment