Introduction to the Pascal Programming Language

© 1998 by Dr. Thomas W. MacFarland -- All Rights Reserved


     Instructions:   Review the following program and see if you can 
                     predict the outcome by completing a "pencil 
                     trace" of the code.  

                     Program output is provided at the end of this 
                     page.

     Compiler:       The program was prepared using Standard Pascal 
                     on a UNIX-based host computer.


% cat PASCAL/intro_pencil-01.p
{ Introduction to the Pascal Programming Language
  Dr. Thomas W. MacFarland
  intro_pencil-01.p         
}

{ The purpose of this program is to:

  1.  Demonstrate the write statement and the writeln 
      statement.

  2.  Demonstrate cursor-control differences between the
      write statement and writeln statements.
}

program Demonstrate_Cursor_Control_With_Write_and_Writeln;

begin

   write('This program');
   writeln('writes something to the.');
   writeln('screen.  What do you see');
   write('now?');
   writeln;

end.  { intro_pencil-01.p      } 
% pc PASCAL/intro_pencil-01.p
% a.out
This programwrites something to the.
screen.  What do you see
now?

Please send comments or suggestions to Dr. Thomas W. MacFarland

There have been visitors to this page since February 1, 1999.