# Project3 - Thomas Nanke CIS 200-001 CIS 200L-001...

This preview shows pages 1–3. Sign up to view the full content.

Thomas Nanke CIS 200-001 CIS 200L-001 Programming Project #3 Recursion and Template 3/24/08

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Question 1: The Machine type that I used for this program is the PC with Microsoft Windows XP Professional as the operating system. The compiler type that I used is the Microsoft Visual 6.0 Compiler. The test machine was an HP (not sure if that knowledge is needed). Here is my source code: #include<iostream> using namespace std; int Combinations(int Y, int X, int level); //function prototype int main() { int X=4; //initializes X to 4 int Y=8; //initializes Y to 8 int level=1; //initializes the recursive level to 1 cout<<"The number of total combinations is "<<Combinations(Y,X,level)<<endl; //here I call on my Combinations function, which is recursive, and //enter the parameters as needed return 0; } int Combinations(int Y, int X, int level) //function implementation { cout<<"Recursive Level: "<<level<<endl; cout<<"Y = "<<Y<<", X = "<<X<<endl; //outputs a trace of each recursive level to the screen, as well as the //values of X and Y in every single trace if(X == 1) //if X=1, the value of Y is returned to be added in the return Y; //recursive call else if(X == Y) //if X=Y, the value of 1 is returned to be added in the return 1; //recursive call else return (Combinations(Y-1,X-1,level+1)+Combinations(Y-1,X,level+1));
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/25/2010 for the course CECS CIS 200 taught by Professor Jieshen during the Winter '08 term at University of Michigan-Dearborn.

### Page1 / 9

Project3 - Thomas Nanke CIS 200-001 CIS 200L-001...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online