uses crt; var pilih:integer; Const MenuItem : Array [1..5] of String[25] = ('1.Celcius ke Fahrenheit ', '2.Fahrenheit ke Celcius ', '3.Celcius ke Reamur ', '4.Reamur ke Celcius ', '5.Keluar Program '); procedure tulis(x,y,c1,c2:integer;t:string); begin textbackground(c1); textcolor(c2); gotoxy(x,y); write(t); end; procedure tulistengah(x,y,w,c:integer;t:string); var p,tgh:integer; begin textcolor(c); p:=length(t); tgh:=round((w-p)/2); gotoxy(x+tgh,y); write(t); end; procedure kotak(x,y,w,h,t,b:integer); var i,j:integer; begin textbackground(b); textcolor(t); gotoxy(x,y); write(chr(201)); for i:=1 to w do begin gotoxy(x+i,y); write(chr(205)); end; gotoxy(x+i+1,y); write(chr(187)); for j:=1 to h do begin gotoxy(x,y+j); write(chr(186)); for i:=1 to w do begin gotoxy(x+i,y+j); write(chr(32)); end; gotoxy(x+i+1,y+j); write(chr(186)); end; gotoxy(x,y+j+1); write(chr(200)); for i:=1 to w do begin gotoxy(x+i,y+j+1); write(chr(205)); end; gotoxy(x+i+1,y+j+1); write(chr(188)); end; procedure menu1; var celcius,fahrenheit:real; begin clrscr; tulis(1,1,1,15,'Masukkan temperatur celcius :');readln(celcius); fahrenheit:=(9/5*celcius)+32; tulis(1,2,1,15,'Equivalent dalam fahrenheit :'); gotoxy(1,3);writeln(fahrenheit:5:0); readln; end; procedure menu2; var celcius,fahrenheit:real; begin clrscr; tulis(1,1,1,15,'Masukkan temperatur fahrenheit :');readln(fahrenheit); celcius:=(5/9*(fahrenheit-32)); tulis(1,2,1,15,'Equivalent dalam celcius :'); gotoxy(1,3);writeln(celcius:5:0); readln; end; procedure menu3; var celcius,reamur:real; begin clrscr; tulis(1,1,1,15,'Masukkan temperatur celcius :');readln(celcius); reamur:=(4/5*celcius); tulis(1,2,1,15,'Equivalent dalam reamur :'); gotoxy(1,3);writeln(reamur:5:0); readln; end; procedure menu4; var celcius,reamur:real; begin clrscr; tulis(1,1,1,15,'Masukkan temperatur reamur :');readln(reamur); celcius:=(5/4*reamur); tulis(1,2,1,15,'Equivalent dalam celcius :'); gotoxy(1,3);writeln(celcius:5:0); readln; end; var baris:integer; begin Repeat textbackground(1); clrscr; kotak(5,5,40,8,15,1); tulistengah(5,6,40,14,'KONVERSI SUHU'); for baris:=1 to 5 do tulis(7,7+baris,1,15,MenuItem[baris]); tulis(7,13,1,15,'Pilihan Anda (1-5) '); readln(baris); case baris of 1: begin menu1; end; 2: begin menu2; end; 3: begin menu3; end; 4: begin menu4; end; end; Until baris=5; end.