#include <iostream>
/* Author: David Yang
 * Name: DumbMult.cpp
 * Date: April 11, 2003
 * Description: Shows a recursive multiplication function
 * 		for purposes of showing how the program stack
 *		supports recursion
 */

/*
 * Description: Recursive implementation of multiplication of 2 int's
 * Parameters: num -- first number to multiply
 *	       count -- # times to add num to current value of product
 * WARNING: does not work if count is negative
 */
int DumbMult(int num, int count)
{
    if (count == 0)
	return 0;
    return num + DumbMult(num, count-1);
}

void main()
{
    int num1, num2;

    // Prompt for numbers
    cout << "Enter num1: ";
    cin >> num1;
    cout << "Enter num2: ";
    cin >> num2;

    // Show result
    cout << num1 << " multiplied by " << num2
	<< " = " << DumbMult(num1, num2) << endl;
}
