home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / pascal / T_LESSON.ZIP / PROG6C.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-04-18  |  767 b   |  34 lines

  1. PROGRAM PROG6C;
  2. {          Copyright (C), 1989 by Lyle Faurot.  All rights reserved.
  3.  
  4.     New Topics: IF statement
  5.                 Conditions used with IF
  6. }
  7.  
  8. VAR
  9.   Have, Want  : Integer;
  10.  
  11. BEGIN
  12.   Write('How many computers do you own? ');
  13.   ReadLn(Have);
  14.   Write('How many computers would you like? ');
  15.   ReadLn(Want);
  16.   WriteLn;
  17.  
  18.  
  19.   If Have >= Want     {Two-way IF .. THEN .. ELSE }
  20.     THEN
  21.       WriteLn('Congratulations! Happy Computing!')
  22.     ELSE
  23.       WriteLn('Sorry about that!');
  24.  
  25.   If Have = 0         {One-way IF .. THEN }
  26.     THEN
  27.       WriteLn('No computer!  Give me a call at 123-4567.');
  28.  
  29.   If (Want - Have) > 2   {Integer expression as part of condition }
  30.     THEN
  31.       WriteLn('Aren''t you a little greedy?');
  32.  
  33. END.
  34.