--- title: "Degree of Conversion" id: 57026 type: "computer_media" slug: "degree-of-conversion" url: "http://localhost/computer_media/degree-of-conversion/" markdown_url: "http://localhost/computer_media/degree-of-conversion.md" published_at: "2024-10-02T07:47:41+00:00" modified_at: "2026-03-30T21:20:01+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2024/10/50_Conv.png" excerpt: "Enter a Fahrenheit range and step size, and this temperature converter prints a tidy three-column F/C/K table with randomly-generated block-graphic borders." category: - name: "Archived Media" slug: "archived-media" taxonomy: "category" url: "http://localhost/category/archived-media/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" genre: - name: "Mathematics" slug: "mathematics" taxonomy: "genre" url: "http://localhost/type/mathematics/" media_contents: - id: 56732 title: "Timex Sinclair Public Domain Library Tape 1001" type: "computer_media" url: "http://localhost/computer_media/timex-sinclair-public-domain-library-tape-1001/" media_type: "Program" mediadate: "198x" images: - url: "http://localhost/wp-content/uploads/2024/10/50_Conv.png" media_type_tags: "Mathematics" --- # Degree of Conversion This program converts temperatures from Fahrenheit to Celsius and Kelvin across a user-defined range and step size. The user inputs a low temperature, a high temperature, and a step interval; the program then prints a three-column table of F, C, and K values. A decorative border effect is produced by printing 32 (then 21) random block-graphic characters using CHR$(10*RND+128), which selects from the Spectrum/TS2068 block graphics in the range 128–137. The program handles reversed input order (high entered before low) by swapping A and B into E and F before the loop at line 300. *** ## Program Analysis ### Program Structure The program is laid out in three broad phases: 1. **Title / decoration (lines 10–60):** Clears, prints a title, then draws a random block-graphic border of 32 characters. 2. **Input (lines 70–210):** Asks for the lowest Fahrenheit temperature, the highest, and the step size. Lines 160–190 reorder inputs so that `F` always holds the lower bound and `E` the upper, regardless of which the user entered first. 3. **Output (lines 220–360):** Clears the screen, prints a column header (F, C, K), draws a second random border of 21 characters, then loops from `F` to `E+Z` in steps of `Z`, computing and printing each row. On exit it saves and re-runs. ### Temperature Conversion The Celsius conversion at line 310 uses the standard formula `C = 5*(D-32)/9`. Kelvin is derived at line 320 as `K = C+273`, using the common rounded value rather than the more precise 273.15. Results are printed with `TAB 8` for the Fahrenheit column and `TAB 24` for Kelvin; the comma separator after `C` advances to the next print zone, placing Kelvin approximately at column 24. ### Input Reordering Logic Lines 160–190 implement a conditional swap without a dedicated temporary variable, using two separate flag-style assignments: - Line 160: `IF B