다양한 기본 데이터 유형 길이
2123 단어 기본 데이터 유형
#include<iostream>
#include<map>
using namespace std;
class MapSort{
public:
bool operator()(int size1,int size2){
return size1<size2;
}
};
template<typename T>
void print(T t)
{
typename T::const_iterator iter = t.begin();
while(iter!=t.end()){
cout << iter->second << iter->first << endl;
iter++;
}
}
int main()
{
multimap<int,char*,MapSort> sizeMap;
sizeMap.insert(pair<int,char*>(sizeof(unsigned char),"unsigned char:"));
sizeMap.insert(pair<int,char*>(sizeof(char),"char:"));
sizeMap.insert(pair<int,char*>(sizeof(unsigned short),"unsigned short:"));
sizeMap.insert(pair<int,char*>(sizeof(short),"short:"));
sizeMap.insert(pair<int,char*>(sizeof(unsigned int),"unsigned int:"));
sizeMap.insert(pair<int,char*>(sizeof(int),"int:"));
sizeMap.insert(pair<int,char*>(sizeof(float),"float:"));
sizeMap.insert(pair<int,char*>(sizeof(double),"double:"));
sizeMap.insert(pair<int,char*>(sizeof(unsigned long),"unsigned long:"));
sizeMap.insert(pair<int,char*>(sizeof(long),"long:"));
sizeMap.insert(pair<int,char*>(sizeof(long long),"long long:"));
sizeMap.insert(pair<int,char*>(sizeof(string)," string:"));
print(sizeMap);
}
gcc:
unsigned char:1
char:1
unsigned short:2
short:2
unsigned int:4
int:4
float:4
unsigned long:4
long:4
string:4
double:8
long long:8
vs2008,xp:
unsigned char:1
char:1
unsigned short:2
short:2
unsigned int:4
int:4
float:4
unsigned long:4
long:4
double:8
long long:8
string:32
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
기본 데이터 유형 대상 포장류는 어떤 작용을 합니까?어떻게 사용합니까?4 2 문자열을 기본 데이터 형식으로 변환: xxx a = Xxx.parseXxx(String) ; 둘.JDK 1.5 새로운 기능: 인쇄 결과는 다음과 같습니다. 새로운 기능: 1. 기본 데이터 형식의 대상에 직접 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.