Skip to content

Instantly share code, notes, and snippets.

@tuankiet65
Created May 28, 2013 04:06
Show Gist options
  • Save tuankiet65/5660464 to your computer and use it in GitHub Desktop.
Save tuankiet65/5660464 to your computer and use it in GitHub Desktop.
program vnanswer2;
uses crt;
var t, t2, tout: text;
s: string;
sl, inp: longint;
begin
clrscr;
assign(t, 'hoten.txt');
reset(t);
assign(t2, 'sanpham.dat');
reset(t2);
assign(tout, 'tongsp.dat');
rewrite(tout);
sl:=0;
while not eof(t) do begin
readln(t, s);
write(tout, s);
while not eoln(t2) do begin
read(t2, inp);
write(tout, ' ', inp);
sl:=sl+inp;
end;
writeln(tout, ' ', sl);
sl:=0;
readln(t2);
end;
write('Xong');
readln;
close(tout);
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment