Skip to content

Instantly share code, notes, and snippets.

@tuankiet65
Created March 18, 2013 12:47
Show Gist options
  • Save tuankiet65/5186922 to your computer and use it in GitHub Desktop.
Save tuankiet65/5186922 to your computer and use it in GitHub Desktop.
Cho dữ liệu trong file input.txt gồm số dòng không rõ, đảo ngược các dòng và xuất ra file ketqua.txt
program string_reverse;
uses crt;
var t, tout: text;
s, s2: widestring;
i: longint;
begin
clrscr;
assign(t, './input.txt');
reset(t);
assign(tout, './ketqua.txt');
rewrite(tout);
while not eof(t) do begin
readln(t, s);
for i:=length(s) downto 1 do s2:=s2+s[i];
writeln(tout, s2);
s2:='';
end;
close(t);
close(tout);
write('Xong');
readkey;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment