program AreaofRectangleOrTriangle;

uses
WinCrt;

var

Base, Height, RectOrTrian,
Area, CharUserInput: Char;

Begin

(*Enter R or T*);
Writeln('Enter R for Rectangle or T for Triangle');
(*Enter Base and Height*);
Writeln('Enter Base ');
Writeln('Enter Height ');
(*Give case statement and formulas*);
if (CharUserInput = 'R') or (CharUserInput = 'r') then
Area := Base * Height
else if (CharUserInput = 'T') or (CharUserInput = 't') then
Area := .5 * Base * Height;
(*Print to screen*);
Writeln('Area is ');

End.

It keeps stopping on the else statement...and I cannot for the life of me figure it out...can someone tell me how to do this?
thanks

Hi,

Unlike C and C++, in Delphi and Pascal char only denotes AlphaNumerical single charactr and can't be used for arithmetic operations. I propose those types :

Base, Height : integer;
Area : single;
RectOrTrian,CharUserInput: Char;

Area can became floating point on triangle case because of the multiplication with half, and you don't need to use ; on comment lines. And I suppose you omited the variable Area on last writeln.

Loren Soth

Thank you...I did it a little different, and was able to get it to work but about the same.

I am trying to teach myself how to program, and here is another one in the book I am having trouble with. It is suppose to display appropriate information below each one of the catagories.

program ClassOccupancy;

uses
WinCrt;

var

Room, Capacity, Enrollment, EmptySeats,
Filled, NotFilled: Real;

Begin

(*Enter data*);
Writeln('Enter room ');
Writeln('Enter Capacity ');