#includeusing std::cout; using std::cin; using std::endl;#include using std::string; #include #include using std::vector;#include using std::begin; using std::end;#include using std::size_t; int main(){ int ia; cout << "the bytes of int is " << sizeof ia << endl; short sa; cout << "the bytes of short is " << sizeof sa << endl; long la; cout << "the bytes of long is " << sizeof la << endl; long long lla; cout << "the bytes of long long is " << sizeof lla << endl; float fa; cout << "the bytes of float is " << sizeof fa << endl; double da; cout << "the bytes of double is " << sizeof da << endl; long double lda; cout << "the bytes of long double is " << sizeof lda << endl; return 0; }
输出
the bytes of int is 4the bytes of short is 2the bytes of long is 4the bytes of long long is 8the bytes of float is 4the bytes of double is 8the bytes of long double is 12