Is there a trunc function in C++?

后端 未结 7 870
情歌与酒
情歌与酒 2021-01-19 04:52

I searched around and couldn\'t find the trunc function for C++. I know I can do this:

int main()
{
    double a = 12.566789;
    cout <<          


        
7条回答
  •  自闭症患者
    2021-01-19 05:37

    trunc is there, in :

    #include 
    #include 
    
    int main() {
            std::cout << trunc(3.141516) << std::endl; 
    }
    

    I suppose you're looking for something else?

提交回复
热议问题