Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ftoc_-_a_fahrenheit_to_celsius_converter [2011/12/16 22:21]
thomaslocke [The loop]
ftoc_-_a_fahrenheit_to_celsius_converter [2012/03/06 22:20] (current)
cvanvliet fixed a few grammar erros
Line 196: Line 196:
 The //Fahr// variable is of the //​Fahrenheit_Degree_Range//​ type and it's initial value is 0. Why 0? Because we assign it the value //​Fahrenheit_Degree_Range'​First//,​ and the //'​First//​ part equals the first value in the range constraint of the type, in this case 0. Consequently the value for //​Fahrenheit_Degree_Range'​Last//​ is 212. The //Fahr// variable is of the //​Fahrenheit_Degree_Range//​ type and it's initial value is 0. Why 0? Because we assign it the value //​Fahrenheit_Degree_Range'​First//,​ and the //'​First//​ part equals the first value in the range constraint of the type, in this case 0. Consequently the value for //​Fahrenheit_Degree_Range'​Last//​ is 212.
  
-Lets take a look at the final three object declarations:​+Let'​s ​take a look at the final three object declarations:​
  
 <code ada> <code ada>
Line 272: Line 272:
 The //'​Width//​ attribute returns the maximum width of the type, so if we change the //​Fahrenheit_Degree_Range//​ later on, we wouldn'​t have to do a single thing about this call to //Put//; it would simply adjust itself accordingly. The //'​Width//​ attribute returns the maximum width of the type, so if we change the //​Fahrenheit_Degree_Range//​ later on, we wouldn'​t have to do a single thing about this call to //Put//; it would simply adjust itself accordingly.
  
-Lets do some tests with various //Width// parameters:+Let'​s ​do some tests with various //Width// parameters:
  
 <code ada> <code ada>
Line 329: Line 329:
   102  38.89   102  38.89
   103  39.44   103  39.44
- ...+  ​...
  
 As you can see, the single digit values are right-justified and padded with 1 space, the two-digit values come out even, but the rest of the results are expanded to hold the third character. As you can see, the single digit values are right-justified and padded with 1 space, the two-digit values come out even, but the rest of the results are expanded to hold the third character.
Line 347: Line 347:
 The //Fore// parameter gives the minimum character count necessary to output the value preceding the decimal point. As with //Width// for the integer types, //Fore// will automatically expand if necessary. //Aft// sets the precision after the decimal point, in this case 2. And finally //Exp// sets the exponent field size. A value of //Exp => 0// signifies that no exponent will be output. Anything other than zero will output the exponent symbol "​E",​ a +/-, and the digit(s) of the exponent. Note: The value of //Exp// should not be less than zero! The //Fore// parameter gives the minimum character count necessary to output the value preceding the decimal point. As with //Width// for the integer types, //Fore// will automatically expand if necessary. //Aft// sets the precision after the decimal point, in this case 2. And finally //Exp// sets the exponent field size. A value of //Exp => 0// signifies that no exponent will be output. Anything other than zero will output the exponent symbol "​E",​ a +/-, and the digit(s) of the exponent. Note: The value of //Exp// should not be less than zero!
  
-Lets try a few different combinations:​+Let'​s ​try a few different combinations:​
  
 <code ada> <code ada>
Line 450: Line 450:
 <code ada> <code ada>
 New_Line (5); New_Line (5);
-</codee>+</code>
  
 We've already discussed the //exit when// method of [[FtoC_-_A_Fahrenheit_to_Celsius_converter#​The_loop|terminating a loop]], and the final statement is merely a simple counter. The value of //Fahr// is incremented with //Step// on each iteration of the loop. When //Fahr// equals //​Fahrenheit_Degree_Range'​Last//,​ the loop is terminated. We've already discussed the //exit when// method of [[FtoC_-_A_Fahrenheit_to_Celsius_converter#​The_loop|terminating a loop]], and the final statement is merely a simple counter. The value of //Fahr// is incremented with //Step// on each iteration of the loop. When //Fahr// equals //​Fahrenheit_Degree_Range'​Last//,​ the loop is terminated.

Navigation