home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / tempconv.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  1.5 KB  |  61 lines

  1.                                        -- Chapter 5 - Program 6
  2. -- Centigrade to Farenheit temperature table
  3. --
  4. --  This program generates a list of Centigrade and Farenheit
  5. --    temperatures with a note at the freezing point of water
  6. --    and another note at the boiling point of water.
  7.  
  8. with Text_IO;
  9. use Text_IO;
  10.  
  11. procedure TempConv is
  12.  
  13.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  14.    use Int_IO;
  15.  
  16.    Centigrade, Farenheit : INTEGER;
  17.  
  18. begin
  19.    Put("Centigrade to Farenheit temperature table");
  20.    New_Line(2);
  21.    for Count in INTEGER range -2..12 loop
  22.       Centigrade := 10 * Count;
  23.       Farenheit := 32 + Centigrade * 9 / 5;
  24.       Put("C =");
  25.       Put(Centigrade,5);
  26.       Put("    F =");
  27.       Put(Farenheit,5);
  28.       if Centigrade = 0 then
  29.          Put("  Freezing point of water");
  30.       end if;
  31.       if Centigrade = 100 then
  32.          Put("  Boiling point of water");
  33.       end if;
  34.       New_Line;
  35.    end loop;
  36. end TempConv;
  37.  
  38.  
  39.  
  40.  
  41. -- Result of execution
  42.  
  43. -- Centigrade to Farenheit temperature table
  44. --
  45. -- C =  -20    F =   -4
  46. -- C =  -10    F =   14
  47. -- C =    0    F =   32  Freezing point of water
  48. -- C =   10    F =   50
  49. -- C =   20    F =   68
  50. -- C =   30    F =   86
  51. -- C =   40    F =  104
  52. -- C =   50    F =  122
  53. -- C =   60    F =  140
  54. -- C =   70    F =  158
  55. -- C =   80    F =  176
  56. -- C =   90    F =  194
  57. -- C =  100    F =  212  Boiling point of water
  58. -- C =  110    F =  230
  59. -- C =  120    F =  248
  60.  
  61.