4.21打卡

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
double power(double x,int n)
{
    double val=1.0;
    while(n--)
    val*=x;
    return val;
}
int main()
{
    cout<<"5 to the power 2 is "<<power(5,2)<<endl;
    return 0;
}

 

posted @ 2023-04-21 14:33  记得关月亮  阅读(12)  评论(0)    收藏  举报