- Solution
We'll learn different approaches to solve the previous challenge.
Solution 1: Using Function Arguments #
Press + to interact
// power1.cpp#include <iostream>int power(int m, int n){int r = 1;for(int k=1; k<=n; ++k) r*= m;return r;}int main(){std::cout << power(2,10) << std::endl;}