Hi I'm tasked to make a converter I got the conversions and I need to repeat the menu once again instead of killing it.
So I need to repeat the codes starting from the repeat to the, writeln('Tempature Conversion Program'); , up to
writeln ('Converted temperature is: ', tconverted: 8:2, ' degrees ', scale);
readln;
program Project1;
{$mode objfpc}{$H+}
uses
crt,
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
var a, tconverted: real;
f, scale: char;
begin
Repeat
clrscr;
writeln('Tempature Conversion Program');
writeln;
writeln('1. Convert Celsius to Fahrenheit');
writeln('2. Convert Fahrenheit to Celsius');
writeln('3. Convert Celsius to Kelvin');
writeln('4. Convert Kelvin to Celsius');
writeln('5. Convert Kelvin to Fahrenheit');
writeln('6. Convert Fahrenheit to Kelvin');
writeln;
writeln('7. Press 7 to exit');
writeln;
writeln ('Enter a number for temperature conversion ');
readln (a);
writeln ('Enter a number to convert from 1-6 or press 7 to exit');
readln (f);
if f in ['1'] then
begin;
tconverted := a * 9 / 5 + 32;
scale:='F';
end;
if f in ['2'] then
begin;
tconverted:= (a - 32) * 5 / 9;
scale:='C';
end;
if f in ['3'] then
begin
tconverted := a + 273.15;
scale:='K';
end;
if f in ['4'] then
begin
tconverted := a - 273.15;
scale:='C';
end;
if f in ['5'] then
begin
tconverted := a * 9/5 - 459.67;
scale:='F';
end;
if f in ['6'] then
begin
tconverted := (a + 459.67) * 5 / 9;
scale:='K';
end;
writeln ('Converted temperature is: ', tconverted: 8:2, ' degrees ', scale);
readln;
until ;
clrscr;
repeat;
end.