prog3_02.cpp

来自「一本语言类编程书籍」· C++ 代码 · 共 34 行

CPP
34
字号
// Program 3.2 Finding the sizes of data types
#include <iostream>
using std::cout;
using std::endl;

int main() {
  // Output the sizes for integer types
  cout << endl 
       << "Size of type char is "
       << sizeof(char);
  cout << endl 
       << "Size of type short is "
       << sizeof(short);
  cout << endl 
       << "Size of type int is "
       << sizeof(int);
  cout << endl 
       << "Size of type long is "
       << sizeof(long);

  // Output the sizes for floating point types
  cout << endl 
       << "Size of type float is "
       << sizeof(float);
  cout << endl 
       << "Size of type double is "
       << sizeof(double);
  cout << endl 
       << "Size of type long double is "
       << sizeof(long double);
  cout << endl;
  return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?