18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Programming</strong> <strong>Language</strong> Concepts<br />

Program 3-1.<br />

_______________________________________________________________________________<br />

'' Generate a Table of Mathematical Functions on a Separate Output Unit.<br />

'' Program Reads Number of Lines per Page, Number of Table<br />

'' Entries and Output Unit on which Results to be Displayed.<br />

preamble<br />

normally mode is integer<br />

end<br />

main<br />

read PAGE.SIZE, TABLE.SIZE, REPORT.UNIT<br />

call DISPLAY(PAGE.SIZE, TABLE.SIZE, REPORT.UNIT)<br />

stop<br />

end<br />

routine DISPLAY( NO.LINES, TSIZE, UNIT.NO)<br />

use UNIT.NO for output<br />

let page.v = 1<br />

let lines.v = NO.LINES<br />

begin report<br />

begin heading<br />

if page is first<br />

print 1 line as follows<br />

Tabulation of Mathematical Functions<br />

skip 3 output lines<br />

always<br />

print 1 line with page.v as follows<br />

Page No. **<br />

skip 2 output lines<br />

print 1 line as follows<br />

I SQRT(I) I SQ LOG(I)<br />

skip 1 output line<br />

end<br />

'' HEADING SECTION<br />

for J = 1 to TSIZE,<br />

print 1 line with J, SQRT.F(REAL.F(J)), J**2, LOG.10.F(REAL.F(J))<br />

as follows<br />

** **.** **** *.***<br />

end '' REPORT SECTION<br />

return<br />

end '' ROUTINE DISPLAY<br />

_______________________________________________________________________________<br />

In its MAIN routine, this program reads in control data and passes these data to the DISPLAY routine<br />

that uses them in its REPORT section. PAGE.SIZE is used to indicate the number of lines per page,<br />

TABLE.SIZE the number of entries in the Mathematical Table, and REPORT.UNIT the output unit<br />

on which the report is to be produced.<br />

127

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!