第1个回答 推荐于2017-09-25
math库中有pow(x,y)函数,x为底数,y为指数,返回值为结果,如下:
#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;
}本回答被提问者采纳
第2个回答 2009-03-17
#include <iostream>
using namespace std;
#include "math.h"
void main()
{
int a,b;
cin>>a>>b;
cout<<pow(a,b)<<endl;
}
第3个回答 2019-12-29
math库中有pow(x,y)函数,x为底数,y为指数,返回值为结果,如下:
#include
#include
#include
using
namespace
std;
int
main()
{
int
x,
y,
result;
cout<<"Enter
x,y
\n"<
>x>>y;
result=pow(x,y);
cout<<"\nthe
result
is:"<
评论
0
0
0
加载更多