INT_MIN / INT_MAX函数(C++)

文章目录

1. 介绍

 a. 包含于头文件 “climits” 当中

 b. INT_MIN, INT_MAX, UINT_MAX 分别可以得到整型变量的最小值,最大值
在这里插入图片描述

 c. 得到long long int 相关的最值
在这里插入图片描述

2. 使用

 2.1 INT

#include<iostream>
#include<climits>
using namespace std;
int main(){
    
    
    int x = INT_MIN;
    int y = INT_MAX;
    unsigned int z = UINT_MAX;
    cout << x << '\n' << y << '\n' << z ;
}

在这里插入图片描述

 2.2 Long Long

#include<iostream>
#include<climits>
using namespace std;
int main(){
    
    
    long long x = LLONG_MIN;
    long long y = LLONG_MAX;
    unsigned long long z = ULLONG_MAX;
    cout << x << '\n' << y << '\n' << z ;
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_51566349/article/details/128136754