SOURCE FILE: EX0412.CPP


// Test program for CountDown of Example 4.12   
   
#include <iostream.h>
#include <iomanip.h>
  
int main(void)   
{   
   void CountDown(int);   
   CountDown(3);
   
   return 0;   
}   

//
// Example 4.12. Function to count down from parameter CountFrom
// to 1, and then to print Ignition, Blast off!
// Pre:  Integer CountFrom has a value between 5 an 1.
// Post: A countdown from CountFrom has been displayed.
// 

void CountDown(int CountFrom)
{
   switch (CountFrom)
   {
      case 5:  cout << "5\n";
      case 4:  cout << "4\n";
      case 3:  cout << "3\n";
      case 2:  cout << "2\n";
      case 1:  
         cout << "1\n";
         cout << "Ignition\n";
         cout << "Blast off!\n";
   }
}