英語小說單字筆記中2026-2-19

圖片
tamely(テイムリー・ていむりー) 溫順地;順從地 The horse followed him tamely . 馬は テイムリー にかれについていった。 那匹馬溫順地跟著他走。 knotty(ノッティ・のってぃ) 多結的;棘手的;複雜的 It’s a knotty problem to solve. それはとても ノッティ な問題だ。 那是一個相當棘手的問題。

數學函式庫裡的函式

今天要來介紹C++裡面的數學函式庫裡的函式
使用,只要載入include<cmath>就可以使用囉~真是太棒了~
來瞧一瞧有怎樣的函式可以使用呀^^
天花板函式ceil(n)
地板函式floor(n)
絕對零度的絕對值fabs(n)
一除剩下多少的餘數函式fmod(n,m)
複利比原子彈的力量大的次方函式pow(n,m)
根號乘以十的開根號函式sqrt(n)
瞧一瞧範例吧XDD

#include <iostream>
#include <cstdlib>
#include <cmath> 
using namespace std;

int main()
{
    
    cout << "最接近且大於3.14的整數: " << ceil( 3.14 ) <<endl; 
    cout << "最接近且小於3.14的整數: " << floor(3.14) << endl;
    cout << "-1的絕對值: "  << fabs(-1) <<endl;
    cout << "7除以4的餘數:" << fmod(7.0,4.0) <<endl; 
    cout << "2的10次方:" << pow(2.0,10.0) << endl;
    cout << "100開根號: "<< sqrt(100) <<endl; 
    
    system("pause");
    return 0;

}



留言