Lab 8 - 3/14/03 (Individual on paper - though this will only count for 25 points since it's a short lab)

    Today you will work with writing recursive functions

First of all, you will rewrite the following for loops into recursive functions

// sort a vector v
// tip!  only focus on the OUTER loop for recursion purposes
int temp;
for (int b = v.length()-1; b > 0; b--)
    for (int a = 0; a < b; a++)
        if (v[a] > v[b]) {
            temp = v[b];
            v[b] = v[a];
            v[a] = temp;
            }

// calculate the integer exponent
int pow(int base, int power) {
    int result = 1; // anything raised to the 0 power is 1
    for (power = power; power > 0; power--) {
        result = result * base;
        }
}

// calculate the root mean squared
double rootmeansquare(apvector<int> &a) {
    double rms = 0.0;
    for (count = 0; count < a.length(); count++) {
        rms += a[count] * a[count];
        }
    return sqrt(rms);
}