program uconv; uses crt; var ans: char; choice: integer; x: integer; y: real; k: integer; u1: integer; g: integer; begin ans:= 'y'; while(ans <> 'n') do begin clrscr; textcolor(lightgreen); textbackground(black); writeln ('*****************************************************************'); writeln ('Welcome to Thunder''s Unit Converter! Have a nice time converting!'); writeln ('*****************************************************************'); writeln; writeln; writeln; writeln; writeln ('Choose a number and hit Enter!'); writeln; writeln ('1. Celsius to Fahrenheit...'); writeln ('2. Celsius to Kelvin...'); writeln ('3. Fahrenheit to Celsius...'); writeln ('4. Fahrenheit to Kelvin...'); writeln ('5. Kelvin to Celsius...'); writeln ('6. Kelvin to Fahrenheit...'); writeln ('0. Exit this program...'); writeln; readln (choice); if choice=1 then begin clrscr; writeln ('************************************************'); writeln ('Welcome to the ''Celsius to Fahrenheit'' converter!'); writeln ('************************************************'); writeln; writeln; writeln; writeln ('Input your Celsius Degrees...'); writeln; readln (x); y := ( 9 / 5 ) * x + 32; writeln; writeln; writeln; writeln (x,' Celsius is equal to ', y:16:2,' Fahrenheit'); end; if choice=2 then begin clrscr; writeln ('*********************************************'); writeln ('Welcome to the ''Celsius to Kelvin'' converter!'); writeln ('*********************************************'); writeln; writeln; writeln; writeln ('Input your Celsius degrees...'); writeln; readln (x); k := x + 273; writeln; writeln; writeln; writeln (x,' Celsius is equal to ', k,' Kelvin'); end; if choice=3 then begin clrscr; writeln ('********************************************'); writeln ('Welcome to ''Fahrenheit to Celsius'' converter!'); writeln ('********************************************'); writeln; writeln; writeln; writeln ('Input your Fahrenheit degrees...'); writeln; readln (x); y:=((5*x) - (160)) div 9; writeln; writeln; writeln; writeln (x,' Fahrenheit is equal to ', y:16:2,' Celsius'); end; if choice=4 then begin clrscr; writeln ('*******************************************'); writeln ('Welcome to ''Fahrenheit to Kelvin'' converter!'); writeln ('*******************************************'); writeln; writeln; writeln; writeln ('Input your Fahrenheit degrees...'); writeln; readln (x); y:=(((5*x) - (160)) div 9) + 273; writeln; writeln; writeln; writeln (x,' Fahrenheit is equal to ',y:16:2,' Kelvin'); end; if choice=5 then begin clrscr; writeln ('*********************************************'); writeln ('Welcome to the ''Kelvin to Celsius'' converter!'); writeln ('*********************************************'); writeln; writeln; writeln; writeln ('Input your Kelvin degrees...'); writeln; readln (u1); g:= u1 - 273; writeln; writeln; writeln; writeln (u1,' Kelvin is equal to ', g,' Celsius'); end; if choice=6 then begin clrscr; writeln ('***********************************************'); writeln ('Welcome to the ''Kelvin to Fahrenheit'' converter!'); writeln ('***********************************************'); writeln; writeln; writeln; writeln ('Input your Kelvin degrees...'); writeln; readln (u1); g:= u1 - 273; y:= ( 9 / 5 ) * g + 32; writeln; writeln; writeln; writeln (u1,' Kelvin is equal to ',y:16:2,' Fahrenheit'); end; if choice=0 then begin ans:= 'n'; end else begin writeln; writeln; writeln; writeln; writeln ('Thank you for using ''Unit Converter'' by Thunder'); writeln ('Have a nice day!'); writeln; write ('Do you want to keep on converting? (Y/N) '); readln (ans); end; end; clrscr; writeln ('*******************************************************'); writeln ('* *'); writeln ('* Thank you for using ''Unit Converter'' by Thunder *'); writeln ('* *'); writeln ('* Have a nice day! *'); writeln ('* *'); writeln ('*******************************************************'); end.