是的,C++的冪函數(pow)支持浮點數作為參數。例如,可以通過調用pow函數來計算一個浮點數的指數值,如下所示:
#include <iostream>
#include <cmath>
int main() {
double base = 2.5;
double exponent = 3.0;
double result = std::pow(base, exponent);
std::cout << base << " raised to the power of " << exponent << " is " << result << std::endl;
return 0;
}
這段代碼將輸出:2.5 raised to the power of 3 is 15.625。因此,C++的pow函數可以用于計算任意浮點數的冪運算。