美文网首页
c++内置类型范围!

c++内置类型范围!

作者: 峡迩 | 来源:发表于2017-07-30 21:29 被阅读0次
// PATn.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include<iostream>
#include<iomanip>
#include<string>
#include<limits>
#include<iomanip>

using namespace std;

int main()
{
    cout << "type: \t\t\t" << "************size**************" << endl;
    cout << "short: \t\t\t" << "字节数:" << sizeof(short) << endl;
    cout << "最大值:" << (numeric_limits<short>::max)();
    cout << "\t\t最小值:" << (numeric_limits<short>::min)() << endl;
    cout << endl;
    cout << "int: \t\t\t" << "字节数:" << sizeof(int) << endl;
    cout << "最大值:" << (numeric_limits<int>::max)();
    cout << "\t最小值:" << (numeric_limits<int>::min)() << endl;
    cout << endl;
    cout << "unsigned: \t\t" << "字节数:" << sizeof(unsigned) << endl;
    cout << "最大值:" << (numeric_limits<unsigned>::max)();
    cout << "\t最小值:" << (numeric_limits<unsigned>::min)() << endl;
    cout << endl;
    cout << "long: \t\t\t" << "字节数:" << sizeof(long) << endl;
    cout << "最大值:" << (numeric_limits<long>::max)();
    cout << "\t最小值:" << (numeric_limits<long>::min)() << endl;
    cout << endl;
    cout << "unsigned long: \t\t" << "字节数:" << sizeof(unsigned long) << endl;
    cout << "最大值:" << (numeric_limits<unsigned long>::max)();
    cout << "\t最小值:" << (numeric_limits<unsigned long>::min)() << endl;
    cout << endl;
    cout << "long long: \t\t" << "字节数:" << sizeof(long long) << endl;
    cout << "最大值:" << (numeric_limits<long long>::max)();
    cout << "\t\t最小值:" << (numeric_limits<long long>::min)() << endl;
    cout << endl;
    cout << "unsigned long long: \t" << "字节数:" << sizeof(unsigned long long) << endl;
    cout << "最大值:" << (numeric_limits<unsigned long long>::max)();
    cout << "\t\t最小值:" << (numeric_limits<unsigned long long>::min)() << endl;
    cout << endl;
    cout << "double: \t\t" << "字节数:" << sizeof(double) << endl;
    cout << "最大值:" << (numeric_limits<double>::max)();
    cout << "\t最小值:" << (numeric_limits<double>::min)() << endl;
    cout << endl;
    cout << "long double: \t\t" << "字节数:" << sizeof(long double) << endl;
    cout << "最大值:" << (numeric_limits<long double>::max)();
    cout << "\t最小值:" << (numeric_limits<long double>::min)() << endl;
    cout << endl;
    cout << "float: \t\t\t" << "字节数:" << sizeof(float) << endl;
    cout << "最大值:" << (numeric_limits<float>::max)();
    cout << "\t最小值:" << (numeric_limits<float>::min)() << endl;
    return 0;
}

相关文章

  • c++内置类型范围!

  • C++内存篇(一):内置类型的机器实现和sizeof

    内存篇(一):内置类型的机器实现和sizeof 一、内置类型的机器实现 C++内置类型及尺寸: 类型含义最小尺寸b...

  • C++数据类型

    简介 C++数据类型包括基本内置类型、复合类型和自定义数据结构。 基本内置类型:编译器内置的基本类型,包括算数类型...

  • C++与python差异(一)

    内置数据类型(1)c++的内置类型包括基本类型和复合类型,基本类型有算术类型和空类型两种,复合类型是基于基本类型定...

  • C++ 重载 Conversion 运算符

    C++ 中类型转换有四种方式: C 风格的转型 C++ 风格的转型 利用构造函数实现内置类型到用户定义类型的转换 ...

  • C++常用类型转换备忘

    std::string ->const char * c++内置数值类型->std::stringcpp11 支持...

  • #C++ Primer Plus# 第三章 处理数据

    面向对象编程(OOP)的本质:设计并扩展自己的数据类型 内置C++数据类型C++数据类型 标识存储的数据的方法:使...

  • c/c++语言基础

    c/c++语言基础 基本类型(基本内置类型) 构造类型 指针类型 引用类型 空类型 数组 预处理命令 基本类型 基...

  • Cpp:基本内置类型&字面值常量

    一、基本内置类型 C++定义的几种基本的算术类型:int,char,float和bool。以及特殊的void类型,...

  • c++基础知识入门

    c++类型划分 可以粗略的说c++就是在c的基础上增加了class类 c++将类型分为两种,一种是内置类型,一种是...

网友评论

      本文标题:c++内置类型范围!

      本文链接:https://www.haomeiwen.com/subject/osiklxtx.html