Source of storage_linkage_main2.cpp


  1: //storage_linkage_main2.cpp
  2: //Goes with storage_linkage_aux2.cpp. Compile the two files
  3: //separately and link the object files to produce an executable.
  4: //Contains the prototypes of two functions defined in another file.
  5: //The functions themselves illustrate the difference between an
  6: //automatic local variable and a static local variable.

  8: #include <iostream>
  9: using namespace std;

 11: void DoItToA();
 12: void DoItToB();

 14: int main()
 15: {
 16:     cout << endl;
 17:     DoItToA();
 18:     DoItToA();
 19:     DoItToA();
 20:     cout << "Press Enter to continue ... ";  cin.ignore(80, '\n');

 22:     cout << endl;
 23:     DoItToB();
 24:     DoItToB();
 25:     DoItToB();
 26:     cout << "Press Enter to continue ... ";  cin.ignore(80, '\n');
 27: }