home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / education / b / roman / !Roman / ReadMe < prev    next >
Text File  |  1992-05-07  |  2KB  |  69 lines

  1. Programmer's Challenge   Roman Numerals
  2.  
  3. By Ian Knox (Account 22) 28/03/90
  4.  
  5. Two arrays are dimensioned one to store the cardinal Roman 
  6. Numeral characters and the other for their decimal equivalent.
  7.  
  8. Data is read into these two arrays.
  9.  
  10. The program prompts you to enter a number and then traps the 
  11. high and low limits as there are no Roman Numerals for numbers 
  12. less than one and numbers greater than 5000 look silly.
  13.  
  14. The selected number is printed on the screen.
  15.  
  16. The program generates each Roman Numeral or Numeral pair along 
  17. with its decimal equivalent. These consist of the following
  18.  
  19.      M    =   1000       Cardinal Numeral
  20.      IM   =    999     
  21.      VM   =    995
  22.      XM   =    990
  23.      LM   =    950
  24.      CM   =    900
  25.      D    =    500       Cardinal  Numeral
  26.      ID   =    499
  27.      VD   =    495
  28.      XD   =    490
  29.      LD   =    450
  30.      CD   =    400
  31.      C    =    100       Cardinal Numeral
  32.      IC   =     99
  33.      VC   =     95
  34.      XC   =     90
  35.      L    =     50       Cardinal Numeral
  36.      IL   =     49
  37.      VL   =     45
  38.      XL   =     40
  39.      X    =     10       Cardinal Numeral
  40.      IX   =      9
  41.      V    =      5       Cardinal Numeral
  42.      IV   =      4
  43.      I    =      1       Cardinal Numeral
  44.  
  45. There are a few other numeral pairs generated but these are 
  46. ignored because their value is of a Cardinal Numeral and these 
  47. are as follows.
  48.  
  49.      DM   =    500 (D)
  50.      LC   =     50 (L)
  51.      VX   =      5 (V) 
  52.  
  53. As listed the Numerals and Numeral Pairs are used in decreasing 
  54. order in PROCcalc as variables number% (decimal equivalent) and 
  55. roman_equivalent$. The local variable Y% is set to the value X% 
  56. (the uncalculated remainder of the selected number) and the 
  57. subtraction of number%. If Y% has a value greater than zero then 
  58. the character(s) is printed adding to the numeral string of 
  59. characters. The variable X% has number% subtracted from it giving 
  60. a new uncalculated remainder. This is repeated until Y% is less 
  61. than zero when the procedure is exited.
  62.  
  63. By the time all the numeral and numeral pairs have been used the 
  64. complete Roman Numeral is displayed on the screen next to its 
  65. decimal equivalent.       
  66.  
  67.  
  68.  
  69.