카테고리

asm (27) bootloader_x86_grub (1) C (92) compile (11) config (76) CPP (13) CSS (1) debugging (7) gimp (1) Go (1) html (1) Java (1) JavaScript (1) kernel (19) LibreOffice (3) Linux system progamming (21) MFC (1) opencv (4) OpenGL (1) PHP (1) Python (4) qemu (29) shell (3) socket (7) troubleshooting (2) ubuntu18.04 (2) windows (1)

2018/12/06

CPP Integer 정수 표현

#include <iostream>
#include <limits>
using namespace std;

int main() {
int value = 55555;
cout << value << endl;

// 구글 검색 limits.h 표현 가능한 표 확인 가능cout << "Max int value "<< INT8_MAX << endl;
cout << "8bit  Max int value "<< INT8_MAX << endl;
cout << "8bit  Min int value "<< INT8_MIN << endl;
cout << "16bit Max int value "<< INT16_MAX << endl;
cout << "16bit Min int value "<< INT16_MIN << endl;
cout << "32bit Max int value "<< INT32_MAX << endl;
cout << "32bit Min int value "<< INT32_MIN << endl;
cout << "64bit Max int value "<< INT64_MAX << endl;
cout << "64bit Min int value "<< INT64_MIN << endl;

long int lValue = 9223372036854775807;
cout << lValue << " Max range" << endl;

    short int sValue = 32767;
    cout << sValue << " Max range" << endl;

    cout << "Size of int: " << sizeof(int) << "Byte" << endl;
    cout << "Size of shot: " << sizeof(short) << "Byte" << endl;
    cout << "Size of shot: " << sizeof(short int) << "Byte" << endl;

    unsigned int uValue = 2147483649;
    cout << uValue << endl;

return 0;
}

댓글 없음:

댓글 쓰기