日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

c+pow函数的头文件_pow()函数以及C ++中的示例

發(fā)布時(shí)間:2025/3/11 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c+pow函数的头文件_pow()函数以及C ++中的示例 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

c+pow函數(shù)的頭文件

C ++ pow()函數(shù) (C++ pow() function)

pow() function is a library function of cmath header (<math.h> in earlier versions), it is used to find the raise to the power, it accepts two arguments and returns the first argument to the power of the second argument.

pow()函數(shù)是cmath標(biāo)頭的庫(kù)函數(shù)(在早期版本中為<math.h>),用于查找冪的加數(shù),它接受兩個(gè)參數(shù)并將第一個(gè)參數(shù)返回為第二個(gè)參數(shù)的冪。

Syntax of pow() function:

pow()函數(shù)的語(yǔ)法:

pow(x, y);

Parameter(s): x, y – are the numbers to calculate x^y.

參數(shù): x,y –是用于計(jì)算x ^ y的數(shù)字。

Return value: double – it returns double value that is calculate result of x to the power of y.

返回值: double-返回double值,它是x的計(jì)算結(jié)果乘以 y的冪。

Example:

例:

Input:float x = 2;float y = 3;Function call:pow(x,y);Output:8

C ++代碼演示pow()函數(shù)的示例 (C++ code to demonstrate the example of pow() function)

// C++ code to demonstrate the example of // pow() function#include <iostream> #include <cmath> using namespace std;// main code section int main() {float x;float y;//input the valuescout<<"Enter the value of x: ";cin>>x;cout<<"Enter the value of y: ";cin>>y;// calculate the powerfloat result = pow(x,y);cout<<x<<" to the power of "<<y<<" is = "<<result;cout<<endl;return 0; }

Output

輸出量

First run: Enter the value of x: 10 Enter the value of y: 5 10 to the power of 5 is = 100000Second run: Enter the value of x: 10.23 Enter the value of y: 1.5 10.23 to the power of 1.5 is = 32.72Third run: Enter the value of x: 10 Enter the value of y: 0 10 to the power of 0 is = 1 Fourth run: Enter the value of x: 0 Enter the value of y: 1.5 0 to the power of 1.5 is = 0

翻譯自: https://www.includehelp.com/cpp-tutorial/pow-function-with-example.aspx

c+pow函數(shù)的頭文件

總結(jié)

以上是生活随笔為你收集整理的c+pow函数的头文件_pow()函数以及C ++中的示例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。