steph020697
asked on
translation pascal->c++
Could anyone translate this short Pascal program to a C or C++ program??
I know nothing about pascal, so...
program dds;
type
trec = packed record
typ : array[1.. 2] of char;
psd : array[1.. 30] of char;
fic : array[1.. 8] of char;
num : array[1.. 5] of char;
end;
var
rec : trec;
f1 : file of trec;
f2 : text;
psd1 : string;
psd2 : string;
pth1 : string;
pth2 : string;
i : integer;
j : integer;
begin
pth1:=paramstr(1);assign(f 1,pth1);re set(f1);
psd1:=paramstr(2);
i:=length(psd1);
while not(eof(f1))
do
begin
psd2:='';
read(f1,rec);
for j:=1 to i do psd2:=psd2+rec.psd[j];
if (psd1 = psd2) then writeln(rec.psd);
end;
close(f1);
(* close(f2);*)
end.
I know nothing about pascal, so...
program dds;
type
trec = packed record
typ : array[1.. 2] of char;
psd : array[1.. 30] of char;
fic : array[1.. 8] of char;
num : array[1.. 5] of char;
end;
var
rec : trec;
f1 : file of trec;
f2 : text;
psd1 : string;
psd2 : string;
pth1 : string;
pth2 : string;
i : integer;
j : integer;
begin
pth1:=paramstr(1);assign(f
psd1:=paramstr(2);
i:=length(psd1);
while not(eof(f1))
do
begin
psd2:='';
read(f1,rec);
for j:=1 to i do psd2:=psd2+rec.psd[j];
if (psd1 = psd2) then writeln(rec.psd);
end;
close(f1);
(* close(f2);*)
end.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.