Dear Sir,

The following is a good example of Pascal. I understand the font with red in colour is the location of display into screen but could you express the meaning of sales1:7:2, sales2:9:2, sales3:9:2, sales4:9:2, sales5:9:2, sales6:9:2??

Cheers,

uses crt ;

var
sales1,
sales2,
sales3,
sales4,
sales5,
sales6,
total_sales : real ;

begin
clrscr ;
writeln ('Enter sales figures one at at time, pressing ',
'<ENTER> after each one ..') ;
readln (sales1, sales2, sales3, sales4, sales5, sales6) ;
clrscr ;
writeln ('STEPTOE AND SON WEEKLY SALES REPORT') ;
writeln ; writeln ;
writeln (' Day 1 Day 2 Day 3 Day 4 Day 5 ',
'Day 6 Total sales') ;
writeln ;
write (sales1:7:2, sales2:9:2, sales3:9:2, sales4:9:2,
sales5:9:2, sales6:9:2) ;
total_sales := sales1 + sales2 + sales3 + sales4 + sales5
+ sales6 ;
writeln (total_sales:12:2) ;
readln
end.

Hi turbomen :)
You declared your variables as 'real'. 'sales1:7:2'
The real output are similar to the integer except that when the data is put into a field 7 characters wide, it is still displayed in scientific format. Adding a second field descriptor , tells the system how many digits you want displayed after the decimal point.Like in your example is 2.
sales1=the name of the variable
:7=wide range
:2=digits after decimal point :D

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.