Pascal语言编程 高手来啊!

来源:百度知道 编辑:UC知道 时间:2024/05/23 11:11:41
用PASCAL写一个计算器的程序,要求可以做简单的计算(+,-,*,/)还可以自动求出一些简单的2D图形的面积(正方形,三角形,圆,三角形....)
谢谢!~
已知图形的基本条件(边长,半径,底,高......)

看看还有其他要求么?
var
  x:char;
procedure calc;
var
  s,t:string;
  a,b,c:real;
  l:integer;
  w:char;
  check:boolean;
begin
  writeln('Please write down your equation.(EX:14/2)');
  check:=true;
  readln(s);
  l:=1;a:=0;
  while ((s[l]>='0')and(s[l]<='9'))or(s[l]='.') do inc(l);
  dec(l);
  t:=copy(s,1,l);val(t,a);
  t:=copy(s,l+2,length(s));val(t,b);
  w:=s[l+1];
  case w of
    '+':c:=a+b;
    '-':c:=a-b;
    '*':c:=a*b;
    '/':if b=0 then check:=false
               else c:=a/b;
 &