C++指數(shù)函數(shù)
1 回答

慕雪6442864
TA貢獻(xiàn)1812條經(jīng)驗 獲得超5個贊
math庫中有pow(x,y)函數(shù),x為底數(shù),y為指數(shù),返回值為結(jié)果,如下:
#include <stdlib.h>
#include <math.h>
#include<iostream>
using namespace std;
int main() {
int x, y, result;
cout<<"Enter x,y \n"<<endl;
cin>>x>>y;
result=pow(x,y);
cout<<"\nthe result is:"<<result<<endl;
system("pause");
return 0;
}
- 1 回答
- 0 關(guān)注
- 626 瀏覽
添加回答
舉報
0/150
提交
取消