⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 limits.cpp

📁 一些STL的使用范例
💻 CPP
字号:
//limits.cpp
//numeric_limits<>使用范例

//By phoenixinter
//On 11/23/2004

/*Remark;
  long long类型可以表示19位的数。
*/
 
#include<iostream>
#include<limits>
#include<string>
using namespace std;

int main()
{
    //在输出bool类型的时候不是输出0和1,而是输出false和true 
    cout<<boolalpha;
    //输出各种类型的maximum value
    cout<<"max(short):"<<numeric_limits<short>::max()<<endl;
    cout<<"max(int):"<<numeric_limits<int>::max()<<endl;
    cout<<"max(long):"<<numeric_limits<long>::max()<<endl;
    cout<<"max(long long):"<<numeric_limits<long long>::max()<<endl;
    cout<<endl;
    
    cout<<"max(float):"<<numeric_limits<float>::max()<<endl;
    cout<<"max(double):"<<numeric_limits<double>::max()<<endl;
    cout<<"max(long double):"<<numeric_limits<long double>::max()<<endl;
    cout<<"max(long long double):"<<numeric_limits<long long double>::max()<<endl;
       
    system("pause");
    return 0;
}    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -