[ create a new paste ] login | about

Link: http://codepad.org/I2RPxZoR    [ raw code | output | fork ]

hmurcia - C++, pasted on Jan 31:
#include <iostream>
using namespace std;

double potencia(double base, int pot);
double potencia(double base, double pot);

int main() {
    cout << potencia(5.2, 3) << endl;
    cout << potencia(4.0, 2.0);
    cin.get(); cin.get();
}

double potencia(double base, int pot) {
    double r = 1;

    for (int y=0; y<pot; y++)
        r = r * base;
    return r;
}

double potencia(double base, double pot) {
    cout << "\npotencia version 2\n";
    return 0;
}


Output:
1
2
3
4
140.608

potencia version 2
0


Create a new paste based on this one


Comments: