program9.txt
来自「编译原理课程设计大作业PL0文法简易编译器」· 文本 代码 · 共 27 行
TXT
27 行
var oil,help:char;
kg,total:real;
begin
write('Enter the amount in kilograms(kg):');readln(kg);
write('Enter type of the gasonline (a,b,c):');readln(oil);
write('Enter type for service (f,m,e):');readln(help);
case oil of
'a':total:=1.50*kg;
'b':total:=1.35*kg;
'c':total:=1.18*kg;
else writeln('Input Error !');
end;
case help of
'f':;
'm':total:=total*(1-0.05);
'e':total:=total*(1-0.10);
else writeln('Input Error !');
end;
writeln;
writeln('Total is ',total:10:2);
end.