找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 10|回复: 0

关于c++中numeric不同的结果

[复制链接]

357

主题

13

回帖

1225

积分

管理员

积分
1225
发表于 2026-5-29 09:40:27 | 显示全部楼层 |阅读模式
<pre data-copy-code="#include #includeusing namespace std;int main(){    cout << (numeric_limits::max)();}" data-code-enhanced="1" style="margin-top: 6px; margin-bottom: 6px; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: Consolas, Inconsolata, Courier, monospace; position: relative; text-wrap: wrap; overflow: auto; line-height: 22px; color: rgb(0, 0, 0); border-radius: 12px; font-variant-ligatures: common-ligatures; background: rgb(47, 49, 58) !important;">CODE复制
1
#include <iostream>
2
#include<limits>
3
using namespace std;
4

5

6
int main()
7
{
8
    cout << (numeric_limits<bool>::max)();
9
}

这里我得到的结果是1,而下面这段代码

<pre data-copy-code="#include #includeusing namespace std;int main(){    cout << (numeric_limits::max);}" data-code-enhanced="1" style="margin-top: 6px; margin-bottom: 6px; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: Consolas, Inconsolata, Courier, monospace; position: relative; text-wrap: wrap; overflow: auto; line-height: 22px; color: rgb(0, 0, 0); border-radius: 12px; font-variant-ligatures: common-ligatures; background: rgb(47, 49, 58) !important;">CODE复制
1
#include <iostream>
2
#include<limits>
3
using namespace std;
4

5

6
int main()
7
{
8
    cout << (numeric_limits<bool>::max);
9
}

得到的结果是000000013FFA13CA,不知道是为什么,想请大佬解惑.


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|联系我们

GMT+8, 2026-6-10 19:12 , Processed in 0.055247 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表