a615size.cpp

来自「quarto esempi vari per c++ (schemi base)」· C++ 代码 · 共 23 行

CPP
23
字号
// nuovi elementi: sizeof(), double, long double
#include <iostream>

using namespace std;

int main() {
  cout << "Numero di byte occupati\n";
  cout << "\t          char: " <<           sizeof(char) << endl;
  cout << "\t         short: " <<          sizeof(short) << endl;
  cout << "\t           int: " <<            sizeof(int) << endl;
  cout << "\t          long: " <<           sizeof(long) << endl;
  cout << "\t unsigned char: " <<  sizeof(unsigned char) << endl;
  cout << "\tunsigned short: " << sizeof(unsigned short) << endl;
  cout << "\t  unsigned int: " <<   sizeof(unsigned int) << endl;
  cout << "\t unsigned long: " <<  sizeof(unsigned long) << endl;
  cout << "\t   signed char: " <<    sizeof(signed char) << endl;
  cout << "\t         float: " <<          sizeof(float) << endl;
  cout << "\t        double: " <<         sizeof(double) << endl;
  cout << "\t   long double: " <<    sizeof(long double) << endl;
  return 0;
}

⌨️ 快捷键说明

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