Heyyy everyone =). Im a freshman in Highschool taking a computer programming class.
I was just wondering if you guys could look over my code and see if there is anything
that I could have done more efficiently (i.e. using less ram, less code).
The objective of this program is to read data from a .DAT file and display it in a table.
Here is my output as shown in Console.
[IMG]http://i1024.photobucket.com/albums/y303/XM-SeriesX/output.png?t=1298593419[/IMG]
Thanks!

program check2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

const

tab = #9;

(****************************************)


procedure flowrTable;

begin

  writeln ('                                    IDD');
  writeln ('                                    IDD');
  writeln ('                                    IDD');
  writeln ('                                    IDD');
  writeln ('                                    IDD');
  writeln ('                                   I8DDZZI.');
  writeln ('                             8DDDDDDDDDDDDDDDDD.');
  writeln ('                            DDDDDDDDDDDDDDDDDDDD~');
  writeln ('                           DDDDDZ   IDD     =DDD~');
  writeln ('                          DDDDD     IDD         ~');
  writeln ('                          DDDD~     IDD');
  writeln ('                         DDDDI     IDD');
  writeln ('                          DDDDD     IDD');
  writeln ('                          ~DDDDDD+  IDD');
  writeln ('                            DDDDDDDDDDDDZ');
  writeln ('                             .DDDDDDDDDDDDDDDD');
  writeln ('                                    ZDDDDDDDDDDD');
  writeln ('                                    IDD    DDDDDD');
  writeln ('                                    IDD     ~DDDDD');
  writeln ('                                    IDD      DDDDD');
  writeln ('                                    IDD      DDDDD');
  writeln ('                         ~D+        IDD     IDDDD');
  writeln ('                         ~DDDD8     IDD    DDDDD');
  writeln ('                         ~DDDDDDDDDDDDDDDDDDDDD');
  writeln ('                           ODDDDDDDDDDDDDDDDI');
  writeln ('                                  ~~7DD');
  writeln ('                                    IDD');
  writeln ('                                    IDD');
  writeln ('                                   IDD');
  writeln ('                                    IDD');
  writeln ('                                    IDD');
  writeln;
  writeln;
  writeln ('                        <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ');
  writeln ('                          Jordans Bank of Awesomeness   ');
  writeln ('                        >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ');
  writeln;
  writeln;
  writeln('           Date         Transaction            Amount         Balance');
  writeln('           ----------------------------------------------------------');
  writeln;




end;


(****************************************)

procedure readLines (var dataFile : text);
var

  date : string[5];
  beginBalance : real;
  amount : real;
  transType : integer;
  transWords : string;
  balance : real;

begin



  readln( dataFile, beginBalance );
  writeln(tab, '                Beginning Balance                    $',  beginBalance:0:2);
  balance := 2035.47;

  while not eof (dataFile) do
    begin
      readln (datafile, date, transType, amount);

      Case transType Of
        -1: transWords := 'Deposit';
        -2: transWords := 'Withdrawal';
        -3: transWords := 'Bank Charge';
          Else
            transWords := 'Check # ';
            transWords := transWords + formatfloat('####', transType);
          End;

      Case transtype of
      -1: balance := balance + amount;
      -2: balance := balance - amount;
      -3: balance := balance - amount;
        else
          balance := balance - amount;
      end;

      if transWords = 'Deposit' then
        begin
          writeln ( '            ', date,'    ', tab, transWords, '        ',  '         ', '$', amount:0:2, tab, '     $', balance:0:2);
        end

          else

      writeln ( '            ', date,'    ', tab, transWords, '      ',  tab, '$', amount:0:2, tab, '     $', balance:0:2);
    end;





end;







(****************************************)

var
  dataFile : text;



begin

  Assign( dataFile, 'CHECK2.DAT');
  Reset ( dataFile );
  flowrTable;
  readLines ( dataFile);
  close( dataFile );

  readln;


end.

The only thing I can think of is that you can use Format() instead of FormatFloat() if you want to align your 'Amount' values correctly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.