利用pow() 函式, 設計一個可以輕鬆計算冪次與開根號的計算機.

 - #include<iostream>
- #include<cstdlib>
- #include<cmath>
- using namespace std;
- int main()
- {
- double x, y;
- cout<<"請輸入底數: ";
- cin>>x;
- cout<<"請輸入指數: ";
- cin>>y;
- cout<<x<<"的"<<y<<"次方,值為"<<pow(x,y)<<endl;
- system("pause");
- return 0;
- }
複製代碼 |