编程语言
首页 > 编程语言> > C++ limits numeric_limits<type>::max(),numeric_limits<type>::min()

C++ limits numeric_limits<type>::max(),numeric_limits<type>::min()

作者:互联网

#include <limits.h>

void Util::typeLimits12()
{
    cout<<"numeric_limits<int32_t>::max()="<<numeric_limits<int32_t>::max()<<endl;
    cout<<"numeric_limits<int32_t>::min()="<<numeric_limits<int32_t>::min()<<endl;
    cout<<"numeric_limits<uint32_t>::max()="<<numeric_limits<uint32_t>::max()<<endl;
    cout<<"numeric_limits<uint32_t>::min()="<<numeric_limits<uint32_t>::min()<<endl;
    cout<<"numeric_limits<int64_t>::max()="<<numeric_limits<int64_t>::max()<<endl;
    cout<<"numeric_limits<int64_t>::min()="<<numeric_limits<int64_t>::min()<<endl;
    cout<<"numeric_limits<uint64_t>::max()="<<numeric_limits<uint64_t>::max()<<endl;
    cout<<"numeric_limits<uint64_t>::min()="<<numeric_limits<uint64_t>::min()<<endl;
    cout<<"numeric_limits<long double>::max()="<<numeric_limits<long long>::max()<<endl;
    cout<<"numeric_limits<long long>::min()="<<numeric_limits<long long>::min()<<endl;
    cout<<"numeric_limits<unsigned long long>::max()="<<numeric_limits<unsigned long long>::max()<<endl;
    cout<<"numeric_limits<unsigned long long>::max()="<<numeric_limits<unsigned long long>::min()<<endl;
    cout<<fixed<<"numeric_limits<double>::max()="<<numeric_limits<double>::max()<<endl;
    cout<<fixed<<"numeric_limits<double>::min()="<<numeric_limits<double>::min()<<endl;
    cout<<fixed<<"numeric_limits<long double>::max()="<<numeric_limits<long double>::max()<<endl;
    cout<<fixed<<"numeric_limits<long double>::min()="<<numeric_limits<long double>::min()<<endl;
    cout<<getTime()<<",finished in void Util::typeLimits12()!"<<endl;
}
void numericLimits5();


int main(int args,char **argv)
{
    numericLimits5();
    return 0;
}

void numericLimits5()
{
    Util ul;
    ul.typeLimits12();
}

Compile:

g++ -g -std=c++2a -I. *.cpp ./Model/*.cpp -o h1 -luuid -lpthread -lmysqlcppconn;

Run

time ./h1 -1;

 

标签:numericLimits5,limits,min,int,max,void,numeric
来源: https://www.cnblogs.com/Fred1987/p/16388043.html