/****************************************************** ** Name: ** Filename: RecurFuncDrv.cpp ** Project #: Data Structures And Other Objects Using C++ 2nd Edition (Micheal Main & Walter Savich) ** Project Description: Write a recursive function and ensure that it is capable of producing any specified level that is desired. ** Output: This was written by call number 1. This was written by call number 2. This was written by call number 3. This was written by call number 4. This ALSO written by call number 4. This ALSO written by call number 3. This ALSO written by call number 2. This ALSO written by call number 1. ** Input: The number of levels to run the recursive function. ** Algorithm: 1. Input the desired number(levels) of times to run the recursive function. 2. Pass the number of levels into the recursive function located in class RecurFunc. 3. Run the recursive function until the parameters(levels) desired by user are achieved. 4. Exit program. ******************************************************/ // Include files #include #include #include #include "RecurFunc.h" using namespace std; // Global Type Declarations // Function Prototypes void instruct (void); void pause (); //Global Variables - should not be used without good reason. int main() { // Declaration section RecurFunc test; //Using RecurFunc class int Levels; //Number of levels // Executable section instruct (); // Prompt The User To Enter The Number Of Levels cout << "Enter the number of levels: "; cin >> Levels; cout << endl; // Pass The Number Of Levels To The Recursive Function test.recursiveFunc(Levels); pause (); return 0; } void instruct (void) { // Declaration section cout << "This is a test driver to run a recursive function. " << "To use this test driver just enter the number of " << "recursive levels you would like to see performed.\n" << "----------------------------------------------------" << "---------------------------\n" << endl; // Executable section } void pause () { // Declaration section // Executable section cout << "\nPress any key to continue..."; getch(); cout << "\r"; cout << " "; cout << "\r"; } /* Program Output This is a test driver to run a recursive function. To use this test driver just enter the number of recursive levels you would like to see performed. ------------------------------------------------------------------------------- Enter the number of levels: 4 This was written by call number 1. This was written by call number 2. This was written by call number 3. This was written by call number 4. This ALSO written by call number 4. This ALSO written by call number 3. This ALSO written by call number 2. This ALSO written by call number 1. Press any key to continue... */