出租车计费

program TAXI(input,output);
var
  a, b : real;
begin
  write('please input distance. a = ');
  readln(a);
  if a <= 2.0 then
    b := 6
  else
    if a > trunc(a) then
      b := 6+trunc(a-2)*1.8+1
    else
      b := 6+(a-2)*1.8;
    { begin
      b := 6+trunc(a-2)*1.8;
      if a > trunc(a) then
        b := b+1;
    end;

    }

  writeln('Price is ', b:7:2);

end.
posted @ 2010-01-01 18:13  SmartIOI  阅读(126)  评论(0)    收藏  举报
本站采用CC授权如需转载、引用文章,请务必附上作者及来源处。 Creative Commons License