Link to home
Start Free TrialLog in
Avatar of steph020697
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(f1,pth1);reset(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.
ASKER CERTIFIED SOLUTION
Avatar of rmichels
rmichels

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial