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;
- {***** DOI BIT *****}
- function doibit(str: string):string;
- var i:byte;
- begin
- doibit:='';
- for i:=1 to length(str) do
- begin
- if (str[i]='0') then
- doibit:=doibit+'1'
- else
- begin
- if (str[i]='1')
- then doibit:=doibit+'0'
- else
- doibit:=doibit+str[i];
- end;
- end;
- end;
- {***** CHUONG TRINH CHINH *****}
- begin
- clrscr;
- {write('Nhap path file: ');='mao.txt';
- readln(path);}
- path:='/home/thieumao/Desktop/input.txt';
- assign(F, path);
- reset(F);
- i:=0;
- writeln('***FILE INPUT***');
- while (not eof(f)) do
- begin
- while (not eoln(F)) do
- begin
- i:=i+1;
- readln(F,s[i]); writeln('Dong ',i:2,': ',s[i]);
- end;
- {readln(F); writeln;}
- end;
- close(F);
- writeln;
- writeln('***FILE OUTPUT***');
- path2:='/home/thieumao/Desktop/output.txt';
- assign(F2, path2);
- rewrite(F2);
- for j:=1 to i do
- begin
- writeln(F2, doibit(s[j]));
- writeln('Dong',j:2,': ', doibit(s[j]) );
- end;
- close(F2);
- end.
Advertisement
Add Comment
Please, Sign In to add comment