home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PASSRC.ZIP / SHAPES.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-04  |  2KB  |  62 lines

  1.                                       (* Chapter 13 - Program 4 *)
  2. program Calculate_Area_Of_Shapes;
  3.  
  4. uses Areas,Crt;
  5.  
  6. var In_Char : char;
  7.     Length,Width,Height,Base,Radius : real;
  8.  
  9. begin  (* main program *)
  10.    repeat
  11.       Writeln;
  12.       Writeln('Please input the first letter of the selection');
  13.       Writeln('Select shape; Square Rectangle Triangle Circle Quit');
  14.       Write('Requested shape is ');
  15.       Repeat until Keypressed;
  16.       In_Char := ReadKey;
  17.       case UpCase(In_Char) of
  18.        'S' : begin
  19.              Write('Square   Enter length of side ');
  20.              Readln(Length);
  21.              Writeln('The area is ',Area_Of_Square(Length):12:4);
  22.              end;
  23.  
  24.        'R' : begin
  25.              Write('Rectangle   Enter width ');
  26.              Readln(Width);
  27.              Write('Enter height ');
  28.              Read(Height);
  29.              Writeln('    The area is ',
  30.                             Area_Of_Rectangle(Width,Height):12:4);
  31.              end;
  32.  
  33.        'T' : begin
  34.              Write('Triangle     Enter base ');
  35.              Readln(Base);
  36.              Write('Enter height ');
  37.              Read(Height);
  38.              Writeln('    The area is ',
  39.                             Area_Of_Triangle(Base,Height):12:3);
  40.              end;
  41.  
  42.        'C' : begin
  43.              Write('Circle    Enter radius ');
  44.              Readln(Radius);
  45.              Writeln('The area is ',Area_Of_Circle(Radius):12:3);
  46.              end;
  47.  
  48.        'Q' : Writeln('Quit');
  49.        else Writeln(' undefined entry');
  50.       end;
  51.    until (In_Char = 'Q') or (In_Char = 'q');
  52. end.  (* of main program *)
  53.  
  54.  
  55.  
  56.  
  57. { Result of execution
  58.  
  59. (The output depends on the data entered at the keyboard)
  60.  
  61. }
  62.