23 thoughts on “C++ Programming Tutorial 12 – Using Functions (pow function)

  1. Jason Franks says:

    why are you using words like double when you are not doubling it dont make sense. i did a lil change dont know if correct but it makes better sense to me,

    #include <iostream>

    #include <cmath>

    using std::cout;

    using std::cin;

    int main()


    int base, exponent;

    cout << "what is the base?: ";

    cin >> base;

    cout << "what is the exponent?: ";

    cin >> exponent;

    int power = pow(base, exponent);

    cout << power << std::endl;

  2. Terribel says:

    question….. Does the Power double for pow have to be declared on line 14 next to the POW or can it be on line 10 and push everything else down….. just so that all the variables are declared next to each other…… or is this better?

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *