RecursionDemo Sample Application for Visual J# .NET Readme

 

Welcome to RecursionDemo Sample Application for Visual J# NET.  This sample demonstrates the behavior of recursive functions and call-stack.   The sample is written using functionality implemented in Microsoft Supplemental UI Library for Visual J# .NET v1.1


1 System Requirements

To use this sample application for Visual J# .NET, you need:

1.               Either Professional or Academic edition of Microsoft Visual Studio .NET 2003.

OR

Microsoft .NET Framework 1.1 SDK and Visual J# .NET Redistributable Package 1.1

2.               Microsoft® Supplemental UI Library for Visual J# .NET v1.1®  (http://msdn.microsoft.com/vjsharp/supui)


2 Building and Running the Sample

To build and run the Case Study from Visual Studio .NET 2003:

1.       Open the solution file “RecursionDemo.sln” from the sample location.

2.       Build the solution by choosing Build Solution command from the Build menu, or press (CTRL+SHIFT+B).

3.       Start running the application by choosing Start from the Debug Menu, or press F5.

To build and run the sample from the command line:

1.       If the Visual Studio development environment is installed, start the Visual Studio Command Prompt. The required environment variables can also be enabled by running sdkvars.bat.

2.       Change directory to the location of the sample.

3.       Type build.bat and press Enter.

4.       Type RecursionDemo.exe and press Enter.


3 Using the sample

To use the sample, choose the recursive function that you want to demonstrate using the combo box.  Next enter the input to the function in text field (default value is 5).  Press Start button to start the demo.  You can see the output in Output panel and call-stack in Function Calls panel.  You need to press Next to go to next step or press Finish if you want to complete the recursive function call with default delay between calls.


4 Extending the sample

You can extend the sample by writing your own recursive function.  To do so, you need to write your own class implementing RecursionDemo.RecursiveFunction interface.  All methods in this interface except doRecursion(int n) are very simple.  The doRecursion() method will have the logic to implement your recursive function.  It is important that you call RecursionStack.push(int input) immediately after entering this method and RecursionStack.pop(int result) before exiting this method.  For example, refer Factorial.java source code file.  Once you have completed your class, just re-compile the sample and run using the steps given above.   You will find your recursive function listed in the combo box.


© Copyright 2003 Microsoft Corporation. All rights reserved.