I am struggling to work out how to use the Round command, I have bolded the area in which I need it. Thanks for the help in advance.

Edit: Forgot to add, we have to round the number up.

program lab12exc3;

{$APPTYPE CONSOLE}

uses
  SysUtils,ourcrt;
var
length,width,height,area,litresPaint,metresPaint : real;

procedure input_measurements;
begin
write('What is the length of the room? ');
readln(length);
writeln('What is the width of the room? ');
readln(width);
writeln('What is the height of the room? ');
readln(height);
end;

procedure convert_measurements;
begin
area:=(width*length)+(width*height*2)+(height*length*2);
litresPaint:=area*2/20;
metresPaint:=area*2;
end;

procedure display_measurements;
begin
writeln('The total surface area of the room is ',area:6:2,' metres squared.');
writeln('You will need ',metresPaint:6:2,' metres squared of paint.');
writeln('This equates to ',[B](litresPaint):6:2[/B],' litres of paint.');
end;

begin
input_measurements;
convert_measurements;
display_measurements;
readln;
end.

Hi Kirky89.
the answer is simple,just listen my(your) code :D

program lab12exc3;

{$APPTYPE CONSOLE}

uses
  SysUtils{ourcrt};
var
length,width,height,area,litresPaint,metresPaint : real;

procedure input_measurements;
begin
write('What is the length of the room? ');
readln(length);
writeln('What is the width of the room? ');
readln(width);
writeln('What is the height of the room? ');
readln(height);
end;

procedure convert_measurements;
begin
area:=(width*length)+(width*height*2)+(height*length*2);
litresPaint:=area*2/20;
metresPaint:=area*2;
end;

procedure display_measurements;
begin
writeln('The total surface area of the room is ',area:6:2,' metres squared.');
writeln('You will need ',metresPaint:6:2,' metres squared of paint.');
writeln('This equates to ',Round(litresPaint),' litres of paint.');{!}
end;

begin
input_measurements;
convert_measurements;
display_measurements;
readln;
end.

by the way there are another round functions, look at these too

(*
Int will give you the number before the comma in a real number.
*)
program Convert;

var
r: Real;

begin
r := Int(3.14);
end.
(*
Frac will give you the number after the comma in a real number.
*)
program Convert;

var
r: Real;

begin
r := Frac(3.14);
end.
(*
Round will round off a real number to the nearest integer.
*)
program Convert;

var
i: Integer;

begin
i := Round(3.14);
end.
(*
Trunc will give you the number before the comma of a real number 
as an integer.
*)
program Convert;

var
i: Integer;

begin
i := Trunc(3.14);
end.

(*

-= By FlamingClaw 2009.10.02.=-

*)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.