How to resolve the algorithm Pinstripe/Printer step by step in the Phix programming language
How to resolve the algorithm Pinstripe/Printer step by step in the Phix programming language
Table of Contents
Problem Statement
The task is to demonstrate the creation of a series of 1 point wide vertical pinstripes with a sufficient number of pinstripes to span the entire width of the printed page (except for the last pinstripe). The pinstripes should alternate one point white, one point black. (Where the printer does not support producing graphics in terms of points, pixels may be substituted in this task.) After the first inch of printing, we switch to a wider 2 point wide vertical pinstripe pattern. alternating two points white, two points black. We then switch to 3 points wide for the next inch, and then 4 points wide, etc. This trend continues for the entire length of the page (or for 12 inches of run length in the case of a printer using continuous roll stationery). After printing the test pattern the page is ejected (or the test pattern is rolled clear of the printer enclosure, in the case of continuous roll printers). Note that it is an acceptable solution to use the smallest marks that the language provides, rather than working at native printer resolution, where this is not achievable from within the language. Optionally, on systems where the printer resolution cannot be determined, it is permissible to prompt the user for printer resolution, and to calculate point size based on user input, enabling fractional point sizes to be used.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Pinstripe/Printer step by step in the Phix programming language
Source code in the phix programming language
You may also check:How to resolve the algorithm Check input device is a terminal step by step in the Quackery programming language
You may also check:How to resolve the algorithm Find if a point is within a triangle step by step in the D programming language
You may also check:How to resolve the algorithm Deceptive numbers step by step in the Julia programming language
You may also check:How to resolve the algorithm Special characters step by step in the Ruby programming language
You may also check:How to resolve the algorithm Bernoulli numbers step by step in the Sidef programming language