c++內(nèi)置類(lèi)型范圍!

// PATn.cpp : 定義控制臺(tái)應(yīng)用程序的入口點(diǎn)。
//

#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" << "字節(jié)數(shù):" << sizeof(short) << endl;
    cout << "最大值:" << (numeric_limits<short>::max)();
    cout << "\t\t最小值:" << (numeric_limits<short>::min)() << endl;
    cout << endl;
    cout << "int: \t\t\t" << "字節(jié)數(shù):" << sizeof(int) << endl;
    cout << "最大值:" << (numeric_limits<int>::max)();
    cout << "\t最小值:" << (numeric_limits<int>::min)() << endl;
    cout << endl;
    cout << "unsigned: \t\t" << "字節(jié)數(shù):" << sizeof(unsigned) << endl;
    cout << "最大值:" << (numeric_limits<unsigned>::max)();
    cout << "\t最小值:" << (numeric_limits<unsigned>::min)() << endl;
    cout << endl;
    cout << "long: \t\t\t" << "字節(jié)數(shù):" << sizeof(long) << endl;
    cout << "最大值:" << (numeric_limits<long>::max)();
    cout << "\t最小值:" << (numeric_limits<long>::min)() << endl;
    cout << endl;
    cout << "unsigned long: \t\t" << "字節(jié)數(shù):" << 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" << "字節(jié)數(shù):" << 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" << "字節(jié)數(shù):" << 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" << "字節(jié)數(shù):" << sizeof(double) << endl;
    cout << "最大值:" << (numeric_limits<double>::max)();
    cout << "\t最小值:" << (numeric_limits<double>::min)() << endl;
    cout << endl;
    cout << "long double: \t\t" << "字節(jié)數(shù):" << 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" << "字節(jié)數(shù):" << sizeof(float) << endl;
    cout << "最大值:" << (numeric_limits<float>::max)();
    cout << "\t最小值:" << (numeric_limits<float>::min)() << endl;
    return 0;
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容