![]() |
#2
我是菜鸟C2011-12-03 09:41
|
#include<iostream>
using namespace std;
template<typename T>
T pow(T a, T b)
{
while(b>0)
{
b--;
return a*a;
}
}
int main()
{
int X,k;
cout << "please input X and k:";
cin >> X >> k;
cout << "X^k="<<pow(X,k)<<endl;
return 0;
}
1 个警告: warning C4715: “pow<int>”: 不是所有的控件路径都返回值