โปรแกรม คำนวณ สี่เหลี่ยม สามเหลี่ยม วงกลม แบบเลือก Choice ใช้ Case นะครับ
ถูกขอมาโดยคุณ ศตวรรษ ทองศรี มีไฟล์คำถามโหลดได้ที่นี่
คลิกเล๊ย!!
Code programprogram it4x;
uses crt;
var x,i,base,high:integer;
begin
clrscr;
writeln('Welcome To Program Calculator');
writeln('-----------------------------');
writeln('1.Rectangle');
writeln('2.Circle');
writeln('3.Triangle');
writeln;
write('Please Select Choice : ');
readln(i);
case i of
1 : begin
clrscr;
writeln('Program Rectangle');
writeln('-----------------');
writeln;
write('Input Your High = ');readln(high);
write('Input Your Base = ');readln(base);
writeln('Area Of Rectangle is = ',high*base);
end;
2 : begin
clrscr;
writeln('Program Circle');
writeln('--------------');
writeln;
write('Input Your Radius = ');readln(x);
writeln('Area Of Circle is = ',3.14*x*x:1:2);
end;
3 : begin
clrscr;
writeln('Program Triangle');
writeln('----------------');
writeln;
write('Input Your High = ');readln(high);
write('Input Your Base = ');readln(base);
writeln('Area Of Rectangle is = ',0.5*high*base:1:2);
end;
else
begin
clrscr;
writeln('Your Unkwon Choice!!')
end;
end;
writeln;
write('Press Any Key To Exit');
readln;
end.