Типи даних 30_09_2011 Печать
Добавил(а) Administrator   
14.10.11 11:55

Тип данных:

Размер в байтах:

Численный разброс:

Char

1

один символ

Short

2

от -2^8 до 2^8

Int

4

от -2^16 до 2^16

Float

4

от -2^16 до 2^16

Long

4

от -2^16 до 2^16

Double

8

от -2^32 до 2^32

Long Double

8

от -2^32 до 2^32

Unsigned Short

2

от 0 до 2^16

Unsigned Int

4

от 0 до 2^32

Unsigned Float

4

от 0 до 2^32

Unsigned Double

8

от 0 до 2^64

 

unsigned char 1 от 0 до 255
wchar_t 2 от 0 до 65535
short 2 от -32768 to +32767
unsigned short 2 от 0 до 65535
int 4 от -2147483648 до 2147483647
unsigned int 4 от 0 до 4294967295
long 4 от -2147483648 до 2147483647
unsigned long 4 от 0 до 4294967295
float 4 ± 3,4x10±38, примерно с 7-значной точностью
double 8 ± 1,7x10*308, примерно с 15-значной точностью
long double 8 ± 1,7x10*308, примерно с 15-значной точностью

 

#include "stdafx.h"

#include <iostream>

using namespace std;

 

void main( void )

{

cout << " (unsigned)int = " << sizeof(int) << endl;

cout << " (unsigned)short = " << sizeof(short) << endl;

cout << " (unsigned)char = " << sizeof(char) << endl;

cout << " (unsigned)float = " << sizeof(float) << endl;

cout << " (unsigned)double = " << sizeof(double) << endl;

cout << " (unsigned)long = " << sizeof(long) << endl;

cout << " (unsigned)long double = " << sizeof(long double) << endl;

cout << " (unsigned)long long int = " << sizeof(long long int) << endl;

cout << " (unsigned)unsigned long long int = " << sizeof(unsigned long long int) << endl;

cout << " (unsigned)__int64 = " << sizeof(__int64) << endl;

}